MS DOS use
Entering or starting MS DOS
- The DOS shell is a program in Microsoft Windows that uses text commands from the user to run programs on the computer.
- These text commands are usually created by typing them in using the keyboard. To do some java programming on the Windows system, you will need to know some basic DOS commands to get around effectively. You can start a DOS shell within Windows 2 different ways
Method 1
- Click on the Start Menu
- Click on Run
- Type cmd and click on OK.
Method 2
- Click on the Start Menu
- Click on All Programs
- Click on Accessories
- Click on Command Prompt
Navigation
- The DOS shell provides a command-line prompt (e.g. C:\>) that tells the user that it is waiting for a command. The command is typed in and sent to the DOS shell by pressing the Enter key. The C:\> prompt indicates that you are currently operating DOS within the top-level directory (\) of DOS.
- Sometimes your prompt may look like this: C:\WINDOWS>
- This indicates that you are in the WINDOWS directory which is one level below the top-level directory.
- To change directories, you can use the cd (change directory) command. If you are in the WINDOWS directory and want to move up to the top-level directory, type cd and press the Enter key. This will place you in the top-level directory and your prompt should be C:\>. The C indicates the C drive which is typically the main hard disk on the system.
- To move down a directory level, type cd followed by the name of the directory. For example, to move from the top-level directory (C:/>) to the WINDOWS directory, type cd WINDOWS. (The command is not case sensitive so it can be entered in upper or lower case characters.) Your prompt will then be C:\WINDOWS>.
- The diskette (or floppy disk) drive is typically called the "A" drive. To change to the A drive, type the name of the drive followed by a colon and press the Enterkey.
- Example: cd A: and press the Enter key. If you were at C:\> your prompt should now be A:\>. To go back to the C drive, type C: and press the Enter key.
Copying, deleting or renaming a file
- To copy a file, you should have already determined where the file currently resides (Source) and where you want a copy of that file to be located (Destination).
- At a DOS prompt, type the command copy followed by the Source's path and filename.
- Example: c:\windows\MyProg.java
- Enter a space and then enter the Destination, which for example could be the A: drive. The command would look like this:
-
copy c:\windows\MyProg.java A:
-
This will copy the file named MyProg.java currently residing in the C:\windows directory to the diskette (indicated by the A: in the command above.
Delete a file from the disk or diskette
- Use the del (Delete) command as follows:del MyProg.java
- This command would delete the MyProg.java file.
- When Renaming a file, you should also have first determined the current filename and location and what you want to name the file. Again, Source and Destination. The Source is the current name of the file and the Destination is the new name of the file.
-
Example: The command to Rename a file could look like this:
-
ren MyProg.java MyProgram.java
-
This command would rename a file called MyProg.java to MyProgram.java.
-
Editing a file
- To edit a file, type Edit at the prompt. This will display a screen in which you can type the contents of the file. A mouse can be used with the file menu. The file menu is used to save the file to a disk (or diskette) or to exit the program. This same file menu is used to exit the editor.
- If you already have a file and want to edit it further, type Edit and then a space, and then, before pressing Enter, type the name of the file you want to edit.
