We repair Windows by either using the Windows Recovery Console to find, and fix a problem, or to do an in place repair installation.
The former is less destructive (if it is used successfully), while the latter has a better chance of success.
Common sense says try the Recovery Console first, however the Recovery Console may not always the best route to follow. The Recovery Console is a command-line driven interface (much like a Command Prompt window). Not all commands available in a command prompt window are available to you when using the Recovery Console, though the basic commands such as DIR, CD, and DELETE do exist.
If you are not comfortable with a command prompt, the Recovery Console may be intimidating.
To run the Recovery Console, boot the Windows XP distribution CD. After the storage drivers are loaded, setup will load the initial text based setup stage, and display a Welcome to Setup message (FIGURE 1-Figure 1Pressing R starts the Recovery Console process, first by finding all Windows installations.).
FIGURE 1-Figure 1Pressing R starts the Recovery Console process, first by finding all Windows installations.
If you are running the Recovery Console on a notebook computer, be aware that the notebook's CPU power conservation features will not be enabled. On some high-performance notebooks, CPU overheating can occur.
To launch the Recovery Console to repair an existing installation, press R. The Recovery Console starts by searching for compatible installations of Windows. Each installation is found, and listed (Figure 2-The Recovery Console searches the drive, looking for repairable Windows installations. Only one installation was found on this computer.) for selection.
Figure 2-The Recovery Console searches the drive, looking for repairable Windows installations. Only one installation was found on this computer.
The next step in the Recovery Console initialization process is to prompt for the Administrator's password for this installation of Windows. The entered value will be tested against the password stored in the installation's registry.
Once you have successfully entered the Administrator's password, the Recovery Console issues a prompt that is similar to that of a Window's Command Prompt session.
In addition to many the commonly known Command Prompt commands, the Recovery Console adds a few new commands to the list.
Batch allows a text file that contains commands to be executed. If there are a set of commands that must be issued repeatedly (perhaps you are repairing more than one computer), use batch to execute these commands. The inputfile is the file containing the commands. The optional outputfile is the file where the command's output is written. If outputfile is not specified, output is displayed on the console.
The bootcfg command modifies the boot.ini file. The boot.ini file contains bootup information such as multi-boot and debugging options. Parameters for bootcfg are:
· /add -- allows the user to add a windows installation (see scan below), to the boot.ini file.
· /rebuild the entire boot.ini file, prompting for which installations of Windows to add to the boot.ini file.
· /scan all drives for Windows installations. The results may then be used with the /add parameter to add a Windows installation to the boot.ini file.
· /list will list the boot options currently in the boot.ini file. There may be multiple entries for one Windows installation: a normal startup and one or more debugging startups may be present.
· /disableredirect prevents the boot loader output from being redirected to a communications (serial) communications port.
· /redirect [port baudrate] | [useBiosSettings] will allow the boot loader output to be sent to the communications (serial) port. It is possible to set the port's speed, or use the BIOS default settings. Port is specified as COMn where n is the communication's port number.
Only one parameter should be used at a time.
The chkdsk command has two options, /p specifies that the drive should be subjected to an extensive check, and any errors found should be corrected. The /r option will cause chkdsk to check for bad sectors and attempt to recover them. If /r is specified, then /p is automatically also included.
It is possible that a service that has been recently installed, or turned on or off, and is preventing Windows XP from starting up.
If a safe boot will not allow the computer to start, then the Recovery Console disable command may be used to tell Windows XP to disable the service. Also see the enable command, below.
The diskpart command is analogous to the old FDISK command from DOS days. With diskpart partitions on a drive may be either created (with /add) or deleted (with /delete). The diskpart command also takes the device name, drive name, partition name, and size as parameters.
The current partitions on a drive are displayed using the map command.
If you have inadvertently disabled a service that is required to boot, the service may be re-enabled with the enable command.
Also see the disable command, above.
When Window's system files are damaged (or completely missing) perhaps due to an errant installation that has gone awry, these files may be replaced from the original files. Because Microsoft compresses the distribution files into cabinet (.CAB) files, they must be uncompressed to be used. The expand parameter /F specifies the file to be extracted or de-compressed, and /D may be specified to list the files in the cabinet file.
When Windows XP boots, the BIOS has a small program that loads the first sector on the hard disk into memory. The BIOS then passes control to the program that was loaded from the first sector. This drive first sector then loads, and then executes the basic bootstrap code. The bootstrap code then reads boot.ini, and determines which partition is to be booted. It then loads the partition's boot loader files to complete the boot-up process.
If Windows XP won't boot at all, only a few problems can cause this: the drive's master boot record (MBR), the partition's boot-sector (the boot loader), boot.ini or other related file is damaged.
To fix the partition's boot-sector the fixboot command is used. The only parameter is the drive letter (such as C:) of the drive to be fixed.
Like fixboot, fixmbr is used to fix the drive's master boot record. This command updates at the physical drive level, while fixboot updates the partition level boot information.
This command is analogous to FDISK /MBR, in that it re-writes the 'master boot record'. The master boot record is a sector (or sectors) at the beginning of the drive that the BIOS uses to start the bootstrap process. The MBR's code will then load the partition's boot code.
With format a drive may be (re)formatted. The file system used may be FAT, FAT32, or NTFS. The default is the existing file system for the drive, if there is one.
To determine the services available, use listsvc. The enable and disable commands (above) may then be used to enable or disable a service that is preventing a successful startup of Windows XP.
If the system has more than one Windows installation then you may switch between the installations. When the Recovery Console started, you selected the installation to use, the logon command switches between installations without having to restart the Recovery Console.
The map command displays drive, file system, partition sizes, and mappings for drives. The optional ARC parameter tells map to display Advanced RISC Computing (ARC) device names instead of Windows Default device names.
Also see diskpart, above.
Though documented, the net command does nothing, as network support is not loaded in the Recovery Console.
The set command allows setting the values of environment variables. In the Recovery Console only the following environment variables may be set, to either TRUE or FALSE:
· AllowWildCards - allow wild cards in file names.
· AllowAllPaths - allow changing to all directories on all drives, instead of the default restriction to root and system related folders.
· AllowRemovableMedia - Normally the Recovery Console will not allow copying files to a diskette or other removable media. This variable overrides this restriction.
· NoCopyPrompt - If set, copy will overwrite files without prompting for confirmation.
This command performs a change directory to the %systemroot% folder.
With these commands, and the common command prompt commands that I have not listed, you can do a substantial amount of fixing to damaged boot files, and even system files. If the system is not recoverable, the repair console still gives access to files that may need to be recovered.
A repair installation replaces all Windows components and files, and resets many settings and preferences. This option is used when the windows installation have been seriously damaged, but may be recoverable without loosing installed applications and user configurations.
To perform a full repair installation, boot the Windows XP distribution CD. After the loading of storage drivers, setup will load the initial setup stage, and display a Welcome to Setup message. Press ENTER to continue with the installation process.
The next screen displays the Microsoft Windows license.
Following the license agreement, setup will search for an existing installation of Windows XP. If one is found, setup will give the option of pressing R to repair that installation. (The repair option will not be shown if there is no repairable installation of Windows found.)
A repair installation as described will replace all the Windows system files with those from the distribution CD. If the distribution CD does not have the same level of Service Packs as your computer, you will have to reapply the Service Packs.
Because of this, it is recommended that you have a SP-2 (or later, if there is one) disk on hand. You can download the Service Pack from Microsoft's web site (though it is a large download), and write it to a CD-R disk.
Generally a repair installation looks exactly the same as a regular 'clean' or upgrade installation. The differences are selecting repair at the prompt, and that (if everything is successful) your existing applications and data will be still available.