SolutionBase: Using the Windows XP Recovery Console

When Windows XP crashes, panicking won't help. However, knowing how the Windows XP Recovery Console works will help you get a troubled workstation back up and running quickly. Scott Lowe shows you how.

Sometimes, it all comes crashing down about you. You walk into the office to turn on your computer and, rather than the flowing colors of the Windows XP splash screen, you're greeted with a screen in a single color: blue. This screen is telling you of some problem with your Windows XP installation. Perhaps you have a corrupted file on your boot sector, or some other malady has afflicted your PC. Regardless, you can either start pulling together CDs to reinstall your system, or you can give the Recovery Console a shot at fixing the problem first. Here's how it works.

About the Recovery Console

The Recovery Console, first introduced in Windows 2000, lets you access volumes on your system that are inaccessible even from Safe Mode. You can use the Recovery Console to write a new boot sector to your active partition, repair the Master Boot Record, copy files, and more. A complete list of commands available with the Recovery Console is presented later in this article.

There are a couple of ways to use the Recovery Console. First, you can proactively install the Recovery Console right to your hard drive as a boot option, or you can run it directly from the Windows XP installation CD. I'll go over both methods in this article.

Installing to the hard drive

First, you need your Windows XP CD-ROM, as you probably guessed. From a command prompt, change to the I386 directory and execute the winnt32.exe program with the /cmdcons switch (short for command console). Here's an overview of the commands to use, in case you want to cut and paste them to your own system:



winnt32.exe /cmdcons

If you're running Windows XP SP2 on your system, you may receive the message "Setup cannot continue because the version of Windows on your computer is newer than the version on the CD". If this happens to you, and you can't get your hands on a Windows XP SP2 CD, all is not lost, but you'll need to take a little time to integrate XP SP2 into a Windows XP installation folder, which will provide you with a complete Windows XP SP2 installation folder from which you can install the Recovery Console. Follow the steps below to accomplish this:

  1. mkdirxp - Create a folder named "xp" into which you will later copy your pre-SP2 XP CD's i386 folder.
  2. mkdir sp2 - Create a folder named "sp2" into which you will later copy the i386 folder from a downloaded version of Windows XP SP2.
  3. copy cdrom:\i386 xp - Insert your Windows XP CD-ROM into your computer and copy the i386 folder to one of the new directories you just created.
  4. Open Internet Explorer. Go to Microsoft's Web site and download the file named WindowsXP-KB835935-SP2-ENU.exe. Save this file to \sp2. This is the network installation package version of Windows XP service pack 2. When you're done, go back to your command prompt window.
  5. cd \sp2 - Change to the sp2 directory into which you downloaded the SP2 network installation package.
  6. WindowsXP-KB835935-SP2-ENU.exe /integrate:C:\xp - This will start the Windows XP SP2 installer in a way that integrates the SP2 files into the folder containing your pre-SP2 installation files. Follow the instructions in the installer to complete the process.
  7. cd \xp - Change to the installation folder into which you integrated the SP2 files.
  8. winnt32.exe /cmdcons- Execute the winnt32 program to install the command console.

Either way you go about, you'll get the screen shown in Figure A.

Figure A

Dialog box indicating that the Recovery Console will be installed

During the installation process, winnt32.exe makes sure it's using the latest available installer, so it downloads it from Microsoft. If you don't want to use this dynamic update process, add the /dudisable switch to the "winnt32.exe /cmdcons" command.

Figure B

The latest version of the Recovery Console is downloaded from Microsoft

When you're done, the installer gives you a message indicating thus.

Figure C

Once installed, the Recovery Console is ready to use from the system's boot menu

The next time you boot your system, you'll have an additional option to use, as shown below in Figure D.

Figure D

The boot menu now includes the Recovery Console as an option

When you're done, you can boot to the Recovery Console. If you chose this option rather than booting the Recovery Console from the XP CD, skip to the section later in this article entitled "Recovery using the Recovery Console".


Starting the Recovery Console from the Windows XP CD-ROM

To start the Recovery Console from your Windows XP CD-ROM, insert the CD into your system, reboot, and make sure that you're booting from the CD and not the hard drive.

On the first screen of the Windows XP setup, choose the "R" option to start the Recovery Console, as shown below in Figure E.

Figure E

The Windows XP setup screen, showing the Recovery Console option


Recovery using the Recovery Console

The Recovery Console asks you a couple of questions, the first of which is to identify the Windows installation you would like to manage. The Recovery Console is able to manage any Windows installation on your system, so you dual-booters (of Windows, anyway), are in luck.

Figure F

Provide the installation that you'd like to manage with the Recovery Console

To help prevent unauthorized use of the Recovery Console, you need to provide a valid Administrator password.

Figure G

Provide the Administrator password for the Windows installation you'd like to manage

Once the Recovery Console authenticates the credentials you provide, you're brought to a command prompt.

Figure H

The Windows Recovery Console command prompt

From here, you can use a number of different commands that are available in the Recovery Console. Commands available to use include:

  • Attrib - Change the attributes of a file or directory.
  • Batch - Runs commands from a batch file. You can output the results either to the screen or to an output file.
  • Bootcfg - Change the configuration of your system's boot process. This modifies the boot.ini file.
  • Cd - Changes the current directory.
  • ChDir - Changes the current directory.
  • Chkdsk - Checks a disk for errors.
  • Cls - Clears the screen.
  • Copy - Copies a file. Useful if you're having boot problems and need to replace a corrupt file with a good one.
  • Del - Deletes a file.
  • Delete - Deletes a file.
  • Dir - Shows a list of files in the current or specified directory.
  • Disable - Disable a Windows system service or a driver. Good when you can pinpoint a problem with a specific driver or service.
  • Diskpart - Manage partitions using a text-based interface.
  • Enable - Enable device driver or system service.
  • Exit - Exit the Recovery Console and reboot your system.
  • Expand - Enable a Windows system service or a driver.
  • Fixboot - Writes a new boot sector to the system volume. Can sometimes completely repair a non-booting system.
  • Fixmbr - Repairs the master boot record of the system's boot partition. Can also sometimes completely repair a non-booting system.
  • Format - Formats the specified disk partition.
  • Help - Shows you a list of all of the commands available via the Recovery Console.
  • Listsvc - Shows you a list of all of the available drivers and services on your system.
  • Logon - If you have multiple Windows installations, this lets you switch between them and will ask you for appropriate credentials.
  • Map - Display drive letter mapping.
  • Md - Creates a directory.
  • Mkdir - Creates a directory.
  • More - Shows the contents of a text file.
  • Net - Maps a drive letter to a network share.
  • Rd - Deletes a directory.
  • Ren - Renames a file.
  • Rename - Renames a file.
  • Rmdir (Rd) - Deletes a directory.
  • Set - Display or set environment variables for use within the Recovery Console.
  • Systemroot - Changes the current directory to the root of the system. (i.e. changes to C:\Windows)
  • Type - Shows the contents of a text file.

Common recovery commands

Probably the two most useful commands in the Recovery Console are fixboot and fixmbr as they can quickly correct many boot issues with your system.

The fixboot command takes only a single optional parameter--the letter of the drive with the boot sector you'd like to fix. Figure I below shows you the simplicity of this potential fix.

Figure I

The fixboot command can fix many boot sector problems, such as those created by viruses

Likewise, fixmbr, shown in Figure J, can be used in a similar way to write a new master boot record to the system and, like fixboot, takes only a single parameter. In this case, that parameter is the name of the device to which you would like to write the new boot record. When omitted, the system will write the new boot record to the default boot device.

Figure J

Use fixmbr to write a new master boot record to a disk

Another useful command is diskpart, which allows you to manage your system's disk partitions from within the Recovery Console. If you've installed Windows XP before, you've seen diskpart during the installation process. A screenshot is shown below in Figure K.

Figure K

Diskpart allows you to manage your system's disk partitions.

When you're done using the Recovery Console, type 'exit' to reboot your system.

Consoling you during recovery

The Recovery Console can be pretty useful for correcting problems with virus-infected boot records, corrupt DLLs, problem drivers and more. I've used this utility quite a few times to successfully recover some pretty messed up Windows XP systems. It's a great addition to Windows and is another tool in the successful tech's arsenal.