Microsoft’s Disk Operating System, or DOS, was the standard operating system for personal computers through the 1980s, after which Windows made its appearance. DOS, and the command prompt in Windows, has a text-based approach to commands and programs. A set of options, called switches, follow most commands; switches have the form of a forward slash followed by a letter. Each command has its own set of switches, and most switches are unique to a particular command.
Help
- Every standard DOS command has a “help” switch invoked by a slash and question mark following the command as in this example:c:\dir /?When you use the help switch after the command, and press the “Enter” key, the computer displays a brief description of the command along with its optional switches and what they do. The switch causes the command to forgo the command’s usual function, so this is an easy, safe way to learn how to use DOS commands without fear of changing or deleting files.
Quiet Mode
- The commands, “rmdir” and “del,” have a switch called “quiet” invoked with a forward slash and the letter “q.” Without this switch, the commands will prompt you for each file or directory, to prevent unintended file deletion when you use wildcards. For example, the following del command simply deletes the file test.txt:c:\del test.txtThe next command, however, may delete many files ending in “.txt:”c:\del *.txtIt will prompt you for every file it finds. The next command will not issue any prompts:c\del *.txt /qThe commands “copy,” “move” and “xcopy” suppress prompts with the “/y” switch. The “y” part of the switch signifies an automatic “yes” answer to the prompts.
Dir
- The “dir,” or file directory command is one of the most commonly used in DOS. It lists the names of files in your current directory along with creation dates and other important attributes. The “/p” switch pauses long listings at each screenful, giving you a chance to read the file information before it scrolls by. To see the files sorted by name, in alphabetical order, use the “/on” switch with dir. The “/od” switch sorts by date, oldest first, and “/os” lists files sorted by size, smallest first. The attributes switches also use a pair of letters, beginning with an “a.” For example, the following command lists all the hidden files in the current directory:c:\dir /ahThe dir command has several other switches, most of which affect the formatting of the file lists. For example, the “/b” switch gives a “bare” format, listing file names without a header or summary.
Fc
- The DOS file compare utility, “fc,” has several switches that make it more useful. The “/b” switch puts the utility into a binary compare mode, so it can compare any two files byte by byte. Fc does an ASCII compare for text files with the “/l” switch. The “/c” switch tells fc to ignore case differences when comparing text files, so this treats upper and lower-case versions of text as the same. The “/w” switch, also used with text files, ignores differences in white space, such as spaces and tabs.