Essential DOS
Published: 02 Oct 2002 11:59 BST
Most people know how to use DOS utilities like FORMAT and FDISK, but working with many of the other utilities has become a lost art. Let's take a look at how to use some of the tools contained on the boot disk or boot CD I showed you how to create.
ATTRIB
The ATTRIB.EXE command is critical for working with three types of files in a DOS environment: hidden files, read-only files, and system files. By following the ATTRIB command with a filename; a plus or minus sign; and the letter S, H, or R, you can add or remove the hidden, read-only, and system attributes from a file. For example, if you wanted to make every file in your current directory visible, you could use the command below to remove the hidden attribute:
ATTRIB *.* -h
If you wanted to hide a file that was presently visible, you'd enter the ATTRIB command followed by the file name, the plus sign, and an H. The syntax for working with system files and read-only files is identical. The only difference is that you must substitute the H (hidden) with either R (read-only) or S (system). You can also use multiple switches in conjunction with each other. For example, if you wanted to remove all three attributes from a file named TEST.SYS, you'd enter the following command:
ATTRIB TEST.SYS --S --H -R
CHKDSK
Although CHKDSK has never completely gone away, ScanDisk has overshadowed it. However, I believe the CHKDSK command is the quickest and easiest way to see how much disk space is available and if there are any problems with the disk. Issuing the CHKDSK command by itself generates a report, while entering the CHKDSK /F command repairs any errors that are found.
DELTREE
If you've ever tried to delete a large directory structure from the DOS prompt, you know how tedious it can be. You must remove the contents of each subdirectory individually before you can erase the main directory. For example, suppose you had a directory called LETTERS that contained the sub-directories A, B, and C. Using the normal DOS commands, you'd have to enter the following sequence of commands to remove the LETTERS directory:
CD\LETTERS\A
ERASE *.*
CD..
RD A
CD B
ERASE *.*
CD..
RD B
CD C
ERASE *.*
CD..
RD C
ERASE *.*
CD..
RD LETTERS
The DELTREE command replaces this tedious sequence of commands with a single command. Entering DELTREE LETTERS does the same thing as issuing all of the commands above. DELTREE deletes a directory and everything in it, including subdirectories and their contents.
DISKCOPY
The DISKCOPY command is used to duplicate a floppy disk. To use this command, type DISKCOPY followed by the source drive and the destination drive, then press [Enter]. For example, you might enter DISKCOPY A: A:. After doing so, the DISKCOPY utility will prompt you as to when to insert the source disk (the original media) and the destination disk (the blank media), and will walk you through the copy process.
DOSKEY
The DOSKEY command allows you to repeat commands you've already typed by pressing the up arrow. This is especially handy if you're doing a complex procedure with a lot of repetitive typing. To use the command, simply type DOSKEY once, then press [Enter]. From that point until you reboot the machine, any commands that you enter will be buffered. These commands can be recalled by pressing the up arrow. To recall something entered three commands back, for example, you'd press the up arrow three times.









