Key Recovery Console Commands

Sometimes, your system fails to boot and displays a blue screen of gibberish or a message that says the system can't start because a file is missing or corrupt. Your first attempt to fix the problem is a reboot, but sometimes that method doesn't work. In such a situation, the Recovery Console (RC), a new tool in Windows 2000 Professional, might revive your system. (For more information about the RC, see Sean Daily, "Mastering the Recovery Console," page 68.)

RC Setup
To start the RC, run it from the Win2K Pro Setup CD-ROM (if your system supports booting from the CD-ROM) or the Win2K Pro Setup disks. You can also install the RC as a boot option that you can select on system start. Insert the CD-ROM, go to Start, Run, and enter the command line

:\i386\winnt32 /cmdcons

where x is your CD-ROM's drive letter. The command brings up a Win2K Setup dialog box, which asks you whether you want to install the RC; click Yes. You'll need about 7MB of hard disk space for the RC. When Setup completes, the system will prompt you to reboot, after which the RC will appear as a new boot option.

To run the RC from the Win2K Pro Setup disks or CD-ROM, you need to boot your system from the Setup disks or CD-ROM. The text-mode portion of Win2K Pro Setup will start, and Setup will give you the option either to install Win2K Pro (press Enter) or to repair your existing Win2K Pro installation (press R). Select the option to repair your installation. Next, Setup gives you the option to attempt the repair using either the RC (press C) or the emergency disk (press R again).

If your system isn't bootable, I recommend that you press R to use the emergency disk recovery method, even if you don't have an emergency disk. This option automatically verifies that all crucial system files exist undamaged. I used this option to recover my Win2K system after I rendered it unbootable by installing Windows NT 4.0. If the emergency disk method doesn't work, you'll need to restart the system, then start the RC.

Using the RC
Whether you launch the RC from the CD-ROM, from Setup disks, or from a boot option, you'll need to log on after you start the console. A dual-boot system will ask you which installation you want to log on to (e.g., C:\winnt, D:\winnt), and you'll need to enter the administrative password for the installation that you select. Then, a command prompt appears. Type help for a list of commands that the RC supports. Most commands are familiar to Win2K Pro or DOS command-prompt users, but you can get information about a particular command by typing

at a Win2K Pro command prompt. However, the RC display lacks the option to set or reset the archive attribute and instead adds an option to set or reset the compression attribute. The RC display also lacks the /S and /D options to change attributes on subdirectories and folders. Most recovery prompt commands offer a subset of the capabilities that you get when you use the same command in a Win2K command prompt. Several commands are unique to the RC command prompt.

Batch. The Batch command executes a batch file. Batch accepts two arguments—the name of the batch file to run and, optionally, a file that the system can send output to.

Disable. The Disable command lets you prevent services or drivers from starting during a boot. You can use this command if a service or driver crashes during boot. Disable takes one argument—the name of the service that you want to disable (to find service names, use Listsvc). Before this command marks the service as disabled, it prints the startup category. For example, if you type

disable cdrom

the system tells you that the old start type was SERVICE_SYSTEM_START. Note this information so that you can use the Enable command to reverse the process when you're finished troubleshooting.

Diskpart. The Diskpart command partitions a disk. The command can take command-line arguments (type help diskpart to get a list of arguments that Diskpart accepts), but the easiest way to use this command is to type

diskpart

A text screen will list the partitions on your disk. Use the up arrow and down arrow keys to choose a partition or unpartitioned space. After you choose a partition, press the D key to delete the partition. To create a new partition in unpartitioned space, type C.

The system asks you to specify a size for the new partition. When you're finished, press Esc to return to the console. You'll need to use the Format command to format the new partitions.

Enable. The Enable command lets services or drivers start during a boot. The command accepts two arguments—the service name and the start type (if you don't enter a start type, Enable prints a list of valid start types). For example,

enable cdrom SERVICE_SYSTEM_START

enables the cdrom service and sets the service to start when the system boots.

Exit. The Exit command shuts down the RC and restarts the computer.

Expand. The Expand command expands the cabinet (.cab) files that Win2K Pro Setup uses. At a recovery prompt, Expand behaves similarly to the command-prompt version of Expand, but the command accepts slightly different arguments. Use the help expand command to get details about those arguments.

Fixboot. The Fixboot command can save you from disasters such as inadvertently installing NT or Windows 9x after you've installed Win2K Pro—in which case you can't boot Win2K Pro. Fixboot writes a new boot sector that makes the drive bootable and takes one argument—the drive letter to run on. For example,

fixboot c:

writes a new boot sector on the C drive.

Fixmbr. The Fixmbr command attempts to fix the boot partition's Master Boot Record (MBR) and might help you resolve the problem when the system refuses to boot. The command takes one argument—the name of the device that needs a new MBR. If you leave the name blank, Fixmbr will write the new MBR to the default boot device (usually your C drive).

Format. The Format command reformats a bad disk or formats a partition that you create using Diskpart. The only arguments that Format accepts are the drive letter, /Q (quick format), and /FS (file system), which accepts FAT, FAT32, or NTFS as options. For example,

format g: /Q /FS:FAT32

uses quick format to format drive G as FAT32. If you don't specify a file system, format will default to NTFS, which works on a Win2K-only system and can cause problems in a dual-boot environment.

Listsvc. The Listsvc command lists every service and driver on the system, as well as the start type. If you have a system that tries to boot but crashes because of a driver problem, Listsvc might help you. Write down all service names that appear on the blue screen, then start the RC. Type listsvc and look for the service names you wrote down. Then, use Disable to prevent the suspect driver from starting, and exit. If the system doesn't start, boot to the RC and try again.

Logon. In a multiboot environment, the Logon command lets you log on to another partition. Logon lists the partitions, lets you select one, and asks for the administrative password (this procedure is similar to the procedure you use to start the RC).

Map. The Map command lists the drive letters for all drives, as well as the formats that apply to each drive, the size of each drive, and the NT physical device associated with each drive. For example, Map might display the following information for drive C:

C: FAT162047MB
\Device\Harddisk0\Partition1

Map also accepts an optional command-line argument: arc. Map will display the physical-drive mapping in Advanced RISC Computing (ARC) format, which you typically find in the boot.ini file:

C: FAT162047MB
multi(0)disk(0)rdisk(0)
partition(1)

Systemroot. The Systemroot command sets the current directory to the Win2K Pro system directory tree's root (usually C:\winnt).

Recovery commands can be quite useful in reviving your system. When nothing else fixes the problem, the RC might hold the solution.