IST 220 - MSDOS Command Examples
FORMAT, DISKCOPY, DIR, COPY and ERASE
| Format a disk in the A drive | FORMAT A: |
| Format a bootable disk in the A drive | FORMAT A:/S |
| Format a disk in the B drive | FORMAT B: |
| Format a bootable disk in the B drive | FORMAT B:/S |
| Make a complete MSDOS copy of the disk in drive A to drive B | DISKCOPY A: B: |
| Make a complete MSDOS copy of the diskette on a single drive system | DISKCOPY A: A: |
| Copy all files on the disk in drive A to B | COPY A:*.* B: |
| Copy all files on the disk in drive A that have X as the first letter of the file name to B | COPY A:X*.* B: |
| Copy all the files on the disk in drive A with a .COM extension to B | COPY A:*.COM B: |
| Copy all the files on the disk in drive A with an I as the second letter of the name to B | COPY A:?I??????.* B: |
| List on the screen names of all the files on the disk in drive A | DIR A:*.* |
| List on the screen the names of files on the disk in drive A with the .COM extension | DIR A:*.COM |
| List on the screen the names of all the files on the disk in drive A that have an X as the first letter of the file name | DIR A:X*.* |
| List on the screen the names of all the files on the disk in drive A with an I as the second letter of the name | DIR A:?I??????.* |
| Remove from the disk all the files on the disk in drive A | ERASE A:*.* |
| Remove from the disk all the files on the disk in drive A with the .COM extension | ERASE A:*.COM |
| Remove from the disk all the files on the disk in drive A that have X as the first letter of the file name | ERASE A:X*.* |
| Remove from the disk all the files on the disk in drive A with an I as the second letter of the name | ERASE A:?I??????.* |
Notes on the MSDOS COPY Command - The COPY command in MSDOS is used to make copies of files stored on an MSDOS disk. It can be used to copy files from one disk to another under the same name or to make a second copy of a file on the same disk with a new file name. The general form of the command is as follows:
COPY <SOURCE> <DESTINATION>
where both <SOURCE> and <DESTINATION> are file specifications. Remember that a file specification can also include a DISK DRIVE LETTER. Therefore, the following are reasonable examples of the copy command:
| COPY A:COMMAND.COM B:COMMAND.COM |
| COPY A:COMMAND.COM NEW.COM |
| COPY COMMAND.COM NEW.COM |
Copy commands can also use wildcards. The two wildcard characters that are available are "?" and "*". The question mark is used to represent any single character in a file name. The asterisk is used to represent any series of characters. Wildcards may be used for either the filename or extension. When wildcards are used, MSDOS will try to find files that match the FILE SPECIFICATION given. This often results in a series of files being copied at once. Therefore, it is important to become comfortable with wildcards and understand them thoroughly. Wildcards can save a great deal of time, but they can also create a big disaster if you do not use them properly. Some examples of wildcards are as follows:
| COPY A:*.* B:*.* | COPY A:*.DOC B:*.* |
| COPY A:*.DOC B:*.TMP | COPY *.DOC *.TMP |
| COPY A:C*.* B:*.* | COPY A:*.?O? A:*.?X? |
Remember that the copy command can be destructive. That is, if a copy command is given that states the destination file as a file name that already exists, the old file under stored under that name is destroyed. THEREFORE, USE THE COPY COMMAND WITH EXTREME CAUTION!!!
![]() |
Networking Course Pages are maintained by Robert Tureman, Assistant professor of Management Information Systems at Paul D. Camp Community College. This page was last updated on Tuesday, September 01, 1998. |