DOS Commands


DOS is not case sensitive, so you can enter commands in either upper or lower case. There is one exception: when you use the java and javac commands, you must use the correct case when typing the name of the file that contains your Java class.

Paths work the same way in DOS as in Unix, except that DOS uses a backslash ("\") as the path separator, instead of the forward slash ("/") used by Unix.

The * wildcard can be used in DOS commands in the same way it is used in Unix commands.

In this handout, the following notation is used:

     <file>      represents the name of a file, should be replaced with
                 the name of an actual file
     <dir>       represents the name of a directory, should be replaced
                 with the name of an actual directory

Listing Files

There are several ways to get a list of files in a directory; they correspond to the possible ways of listing files under Unix. When reading a directory listing, you will see one line for each file or directory, with two names for each. The first name is the old DOS name, which is limited to 8 characters followed by an extension of at most 3 characters. At the end of each line you will see the full name of the file. You can use either form of the name in any DOS command.
  DIR
Lists all files in the current directory.
  DIR <dir>
Lists all files in the given directory, which must be contained in the current directory.
  DIR <file>
Lists the given file, if it exists in the current directory. This form can be used with the * wildcard, to list groups of files.

File Management Commands

  COPY <file1> <file2>
Makes a copy of <file1> and saves it under the name <file2>.
  RENAME <file1> <file2>
Changes the name of <file1> to <file2>.
  ERASE <file>
Erases a file. Can be used with *, such as:
        ERASE *.java
        ERASE Hello.*
but use with caution.
  PRINT <file>
Prints a file. This command does not work in our labs, but it should work if you have your own computer. To print a file in the lab, open the file in a Cafe edit window or in notepad and use the print command in the application.

Directory Management Commands

  MKDIR <dir>
Creates a new directory with the given name as a subdirectory of the current directory.
  RMDIR <dir>
Deletes the named directory, which must be a subdirectory of the current directory, and must also be empty.
  CD ..
Move to the parent of the current directory and make that the new current directory.
  CD <dir>
Move to the named directory and make that the new current directory. The named directory must be a subdirectory of the current directory.
  MOVE <file> <dir>
Move the file named to the directory named. The * wildcard can be used to move a group of files with one command.

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page