PC Hardware

MS-DOS Terms and Commands

MS-DOS, like UNIX, uses a command-line or text-based user interface. This means that the user must memorize and type commands in order to interface with the operating system. Not exactly a user-friendly operating system, which is why Windows has come to dominate the market. Even today, the computer professional should know how to use and navigate in the MS-DOS environment. When Windows fails, using MS-DOS is often the best way to access any recoverable data and begin the repair process.

Key MS-DOS Terms

As with any operating system, it is important to understand the language or terms used. As mentioned, this is not a complete course in MS-DOS and there is no substitute for an MS-DOS manual. The following table presents some of the important terms and concepts you might encounter when working with MS-DOS.

Term Description
.bat An extension that indicates a batch file.
.com An extension used to identify a file as an executable program file.
.exe An extension used to identify a file as an executable program file.
Backslash (\) A symbol used to separate each directory level, for instance C:\Windows\Utilities. For this reason, it is a reserved character and cannot be used as part of a file name.
Case sensitivity The ability of the operating system to distinguish between uppercase and lowercase letters. MS-DOS commands are not case-sensitive. Traditionally, MS-DOS commands have been represented in documentation as uppercase. While you can type MS-DOS commands in either upper- or lowercase.
Cursor Anytime you are entering data, whether in an application or in an MS-DOS command, the cursor (usually a small flashing line) indicates the place where the next character will be inserted. It is a good idea to always know where your cursor is.
Default drive Each drive in a computer has its own letter designation. The default drive is the active drive. Unless otherwise specified, any commands act upon the default drive. The current default drive is indicated by the MS-DOS prompt. For example, if you want to see a directory (the command is DIR) of files on the A drive and the default drive is C, you need to type DIR A: otherwise you will see a directory of the C drive.
Directory Directories-known as folders in the Windows and Macintosh environments-are locations for storing files. Every disk contains a main directory known as the root directory. Below the root directory is a hierarchical structure of other (sub)directories.
MS-DOS prompt The MS-DOS prompt usually displays the active drive letter (for instance, C:) and directory. This indicates that the operating system is ready to accept the next command. (The prompt is user-changeable.)
Drive pointers MS-DOS assigns letters to each drive during the boot process.
Entering Commands You can type a command and press ENTER to execute it. If you make a mistake, correct it by using the BACKSPACE or DEL keys. Use ESC to start a command again. Use the F3 key to repeat a command.
Error messages Brief technical messages that are displayed when an error occurs.
Filenames (also filespecs) A filename is made up of three parts-a name of up to eight characters, a period, and an extension of up to three characters. The name can include any number, character, or the following symbols: _()~'!%$&#. Spaces cannot be used in MS-DOS filenames. Example: MYFILE.DOC
Greater than (>) This symbol is used to indicate that a command can be redirected to an output device. For example, to redirect the directory command to a printer, type: DIR > LPT1.
Path The address to a file. The path consists of the drive name, the location of the file in the directory structure, and the filename. Example: C:\Mystuff\Myfile.doc.
Prompt The command prompt-user interface provided by COMMAND.COM to signal to the user that the computer is ready to receive input (for example: C:\> or A:\>).
Switches Many MS-DOS commands can be used with a switch ("/" followed by a letter) to invoke special functions. Because no comprehensive manuals are available after MS-DOS 5, when you follow a command with a space and "/?", a list of parameters and switches available for that command is displayed.
Syntax Syntax is the arrangement and interrelationship of words in phrases and sentences. In computer jargon, it is the correct format in which to type a command. In MS-DOS, every letter, number, and space has a value. The most common problem when typing MS-DOS commands is adding or leaving out a letter or character. Simple typing mistakes are the most common cause for "Bad command or filename" errors.
Wildcards The question mark (?) matches any character in a specified position, and the asterisk (*) matches any number of characters up to the end of the filename or extension. For example, to search for files beginning with the letter "A," the command would be DIR A*.* or A?????.* (the second command would find a file that starts with the letter A and any other five characters).

MS-DOS Commands

MS-DOS commands are found in two varieties and locations. The internal MS-DOS commands are stored within the COMMAND.COM file and are always available. These provide key commands needed to access files and manage the operating system. The external MS-DOS commands are larger utilities stored as .COM or .EXE files in the MS-DOS directory. External MS-DOS commands must be on the current drive, some other drive whose location is stored in the PATH variable (that is, they can be in any directory as long the directory name and location is included in the path statement in the AUTOEXEC.BAT file), or be named with the complete path to the executable file to be run. The following table lists examples of commonly used internal MS-DOS commands.

Internal Commands

Command Function
CHDIR or CD Changes the directory. (For example, cd\word would take you to the "word" subdirectory.)
CHKDSK Examines the FAT (file allocation table) and directory structure on a drive, checking for errors and inconsistencies that can keep you from accessing a file. It also locates lost clusters and can convert them into files for later deletion. It can also reclaim wasted space.
CLS Clears the screen.
COPY Copies files or disks. To copy all files from the "myfiles" subdirectory to the A (floppy) drive, the command would be: copy c:\myfiles\*.* a:
DATE Changes the system date.
DEL Deletes files. (Example: c:\del myfile.txt).
DIR Lists a directory of files.
DIR /P Views directories, one page at a time. (Directories can be quite long.)
DIR /W Displays wide format in columns-only the filename is listed; not size, date, or time.
DIR /W /P Displays large directories in columns, one page at a time.
DISKCOMP Compares two disks. The syntax is: a:\ diskcomp a: b: or diskcomp a: a: (the computer will prompt you to insert the second disk to be compared).
MKDIR or MD Makes a directory.
PROMPT Changes the appearance of the cursor.
REN Renames a file.
RMDIR or RD Deletes a directory. This works only if the directory is empty of all files including hidden ones.
TIME Changes the system time.
TYPE Displays (types) a text file.
VER Displays the version of MS-DOS in use.

External Commands

The following table lists examples of commonly used external MS-DOS commands.

Command Function
DISKCOPY Makes a copy of a complete disk. Requires that both the source and the destination disk have the same format.
EDIT This command invokes the text editor program. This program is useful for making changes to text files such as editing CONFIG.SYS and AUTOEXEC.BAT.
FORMAT Prepares a disk for receiving files. Places a root directory on the disk.
FORMAT /S Formats a disk as a system disk.
UNDELETE Will (sometimes) recover a deleted file. Works only if the disk has not been modified since the file was deleted.
XCOPY Copies the contents of one disk to another disk. Does not require both disks to have the same format. (Note that it will not copy hidden files unless you use the /h switch.)

Getting Help in MS-DOS

The later versions of MS-DOS (4.0 and newer) provide some online help. There are two ways to access this information. You can type the word "help" followed by a space and the command, or type the command with the /? switch. In either case, you will get information regarding the proper syntax and available options for the command.