When a Windows system crashes a properly configured boot disk, an adept knowledge of DOS can save you lots of time and effort. I’ve shown you how to create both an emergency repair (or boot) disk and an emergency repair (or boot) CD that can help you repair a crashed Windows system. However, being able to use the disk to effectively repair a system requires knowing how to use the tools each contains.
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.
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
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.
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:
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.
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.
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.
If you’ve ever looked at the contents of your Windows CD, you probably know that all the files that make up Windows are stored in a compressed format within CAB files. If you need to replace a damaged Windows file, you can use the EXTRACT command to decompress the file you need. Space doesn’t allow me to get into all of the particulars of using the EXTRACT command, but it’s important for you to know that the command exists. You can acquire the various syntaxes for the command by typing EXTRACT /?.
The MEM command allows you to view modules and drivers currently loaded in memory. To use this command, simply enter MEM /C at the command prompt. You’ll then see a detailed summary of the machine’s memory usage. Remember that you’re working in DOS mode, so you won’t see anything related to how Windows is using memory unless you use the MEM command while Windows is running. Instead, you’ll see how your boot disk is managing memory.
Sometimes a utility may alter the system’s video settings, making the screen unreadable. If this happens, you can use the MODE command to return the screen to a readable state. For example, to return the screen to a standard DOS format, you’d enter MODE CO80. With any luck, the screen will flicker a few times and then become readable.
Occasionally, you may run into a situation in which a command displays more data than you can read. For example, the MEM /C command almost always scrolls data off of the screen before you can read it. Using the MORE command causes the computer to show you only one screen of information at a time. For example, if you enter MEM /C | MORE, the system will display the memory usage screen-by-screen. The MORE command also works for viewing files. Suppose you have a long text file called README.TXT. If you enter the command TYPE README.TXT, the computer will display the file too quickly to read. However, entering TYPE README.TXT | MORE will cause the computer to display the file one screen at a time.
The SYS command allows you to make any floppy disk or hard disk bootable. For example, if you were working on a computer that had a hard drive with a boot sector destroyed by a virus, you could boot from your emergency repair floppy or CD and run the command SYS C:. This would add the IO.SYS, MSDOD.SYS, and COMMAND.COM files to the damaged hard disk, making it bootable once again.
Keep in mind, though, that any time you use the SYS command on a disk, the boot files from the source disk (floppy, CD, or hard disk) will be copied to the target drive. So make sure that the target system is running the same operating system as the source disk. For example, you could use a repair disk created on a Windows 98 machine as the source disk for another Windows 98 machine, but you wouldn’t want to use a Windows 98 repair disk as the source for a Windows ME machine.
The XCOPY command works just like the COPY command, but there are some very useful switches that you can add to custom-tailor the copy process. For example, supplying the /S switch will tell XCOPY to copy the subdirectories, too. For a complete list of all of the switches available for use with XCOPY, enter the XCOPY /? command.