MS-DOS Command Examples
Logging on to a Drive
When you type in MS-DOS commands, your drive letter is shown on the command line. You can log
on the A: drive (have the A: drive as your prompt) or on to any valid drive by just typing in the drive
letter followed by a colon and then pressing Enter. When you log on to a drive, all your commands will
be executed on that drive - unless you specify otherwise.
Here are the steps:
1. Put a floppy disk into your machine.
2. Open an MS-DOS window. You will be at the C:\> prompt (you may be inside a
directory structure, but you will be on the C: drive)
3. At the prompt, type in A: and press Enter.
4. Do a DIR to prove you are now on a blank drive (a drive with no files on it).
Making A Directory (using MKDIR or MD)
The way you make directories on a disk drive is to use the MKDIR command. The MKDIR command
has a shortened form called MD and you can use either command interchangeably. For our examples,
we will use MKDIR since that command is standard in at least one other operating system (Unix).
For this exercise, we will make a directory called FREEDOM on our floppy diskette. Which we will
use in follow-on exercises. To make the directory, do the following:
1. Put your floppy disk into the computer.
2. Go to MS-DOS and log into the A: drive.
3. Using the MKDIR command, make a directory called FREEDOM. The syntax will be:
MKDIR FREEDOM
(be sure you are on the A: drive when you use the command!)
, Changing Directories (using CHDIR or CD)
Directories are containers that are made to hold your files in a nice orderly way. To get to those
directories and to see the files in them, you would use a combination of the CHDIR (or CD) commands
and the DIR command. Do the following exercise to see how the CHDIR (or CD) command is used.
1. Put your floppy disk in the drive (be sure you have completed the previous MKDIR task)
2. Go to the MS-DOS prompt and log on to the A: drive.
3. Use the CHDIR command to enter the FREEDOM directory that you made previously.
(CD FREEDOM)
4. Use the DIR command to see that there are no files in the directory. (only the . and .. files
and those are for MS-DOS internal use).
5. Using the EDIT command, make two files. Call the first one AAA.TXT and the second
one B.TXT.
6. Exit the EDIT program and do a DIR of the directory so you can see the files you just
made.
7. Use the CHDIR command to get back to the root of the A: drive. ('CD \' is the
command!)
Important Shortcuts To Remember:
To change to the ROOT directory from any directory or subdirectory type:
CHDIR \ {ENTER}
To change to the parent directory of your current directory type:
CHDIR .. {ENTER}
Adding Parameters to a command
A parameter is a letter typed after a command, that tells the command to carry out an extra task. These
parameters are also called 'switches'.
For instance, a command that you've already used is the DIR command. The command with a parameter
might look like this:
DIR /S /P
( The /S and the /P are the parameters. You can use either one.)
Logging on to a Drive
When you type in MS-DOS commands, your drive letter is shown on the command line. You can log
on the A: drive (have the A: drive as your prompt) or on to any valid drive by just typing in the drive
letter followed by a colon and then pressing Enter. When you log on to a drive, all your commands will
be executed on that drive - unless you specify otherwise.
Here are the steps:
1. Put a floppy disk into your machine.
2. Open an MS-DOS window. You will be at the C:\> prompt (you may be inside a
directory structure, but you will be on the C: drive)
3. At the prompt, type in A: and press Enter.
4. Do a DIR to prove you are now on a blank drive (a drive with no files on it).
Making A Directory (using MKDIR or MD)
The way you make directories on a disk drive is to use the MKDIR command. The MKDIR command
has a shortened form called MD and you can use either command interchangeably. For our examples,
we will use MKDIR since that command is standard in at least one other operating system (Unix).
For this exercise, we will make a directory called FREEDOM on our floppy diskette. Which we will
use in follow-on exercises. To make the directory, do the following:
1. Put your floppy disk into the computer.
2. Go to MS-DOS and log into the A: drive.
3. Using the MKDIR command, make a directory called FREEDOM. The syntax will be:
MKDIR FREEDOM
(be sure you are on the A: drive when you use the command!)
, Changing Directories (using CHDIR or CD)
Directories are containers that are made to hold your files in a nice orderly way. To get to those
directories and to see the files in them, you would use a combination of the CHDIR (or CD) commands
and the DIR command. Do the following exercise to see how the CHDIR (or CD) command is used.
1. Put your floppy disk in the drive (be sure you have completed the previous MKDIR task)
2. Go to the MS-DOS prompt and log on to the A: drive.
3. Use the CHDIR command to enter the FREEDOM directory that you made previously.
(CD FREEDOM)
4. Use the DIR command to see that there are no files in the directory. (only the . and .. files
and those are for MS-DOS internal use).
5. Using the EDIT command, make two files. Call the first one AAA.TXT and the second
one B.TXT.
6. Exit the EDIT program and do a DIR of the directory so you can see the files you just
made.
7. Use the CHDIR command to get back to the root of the A: drive. ('CD \' is the
command!)
Important Shortcuts To Remember:
To change to the ROOT directory from any directory or subdirectory type:
CHDIR \ {ENTER}
To change to the parent directory of your current directory type:
CHDIR .. {ENTER}
Adding Parameters to a command
A parameter is a letter typed after a command, that tells the command to carry out an extra task. These
parameters are also called 'switches'.
For instance, a command that you've already used is the DIR command. The command with a parameter
might look like this:
DIR /S /P
( The /S and the /P are the parameters. You can use either one.)