Repairing Windows XP in Eight Commands
Revised by NlightN for better accuracy
from post by Robert “Thrax” Hallock
Most of us have seen it at one time or another; perhaps on our own PC, the PC of a loved one, or perhaps a PC at your place of employment. The system spends weeks or months operating in a smooth fashion, taking you to the far reaches of the world wide web, and after one particularly late evening of browsing and gaming, you shut your PC off and go to bed. Millions of people across the globe do just this every night, but a few of us have turned our PCs on the next day not to the standard Windows XP loading screen, but instead this dreaded error:
Windows could not start because the following file is missing or corrupt:
\WINDOWS\SYSTEM32\CONFIG\SYSTEM
You can attempt to repair this file by starting Windows Setup
using the original Setup CD-ROM.
Select 'R' at the first screen to start repair.
Which renders your PC inaccessible from the standard boot procedures of Windows XP. You try safe mode, to no avail. You’re particularly savvy and try issuing the FIXBOOT and FIXMBR commands in the Windows recovery console, but after each reboot, you’re merely greeted with the same obnoxious and terrifying blue screen of death that’s preventing you from accessing your precious data.
Perhaps you’ve also seen these error screens:
Windows NT could not start because the below file is missing or corrupt:
X:\WINNT\System32\Ntoskrnl.exe
_________________
Windows NT could not start because the below file is missing or corrupt:
X:\WINNT\System32\HAL.dll
_________________
NTLDR is Missing
Press any key to restart
_________________
Invalid boot.ini
Press any key to restart
Obtain an install CD and Put CD in drive and reboot.(preferably CD with same service pack)
Hit F12 for Boot Menu and select CD/DVD drive
Hit spacebar on "Boot from CD"
If you dont see this, then you will have to go in the BIOs and change the setting for Boot Order. To get in BIOs, hit Delete, F1, F2 or whatever your machine requires to enter BIOs seettings. Look for something similar to Boot Sequence or Boot Order. Change the order so the CD/DVD drive is first. After changing Boot Order, Hit F10 key and confirm Yes to save.
This will reboot the machine. Hit the space bar when asked "Boot from CD"
Let it run and You will get Welcome to Setup. Select "R" for Recovery Console
select a valid Windows installation (Typically number “1”

.
Type 1 <enter>
Enter administrator password for the administrator account or leave blank if none <enter>
You need to navigate to the root of the drive C:\
If you see C:\windows>
then change directory with the following
C:\WINDOWS>CD .. <enter> (Yes thats two dots)
At the C:\> prompt, type CHKDSK
If it says it test good, put in code to do anyway
c:\>chkdsk /p /r <enter>
Try the reboot and should be good.
If not try the next level of recovery,
Get back in the Recovery Console mentioned above and do the following
Get to the basic root of C:\
Now that we are at C:\ we can begin the process of repairing the operating system and that begins with modifying the attributes of the BOOT.INI file. Briefly, BOOT.INI controls what operating systems the Windows boot process can see, how to load them, and where they’re located on your disk. We’re going to make sure the file is no longer hidden from our prying eyes, remove the flag that sets it as an undeletable system file, and remove the flag that sets it as a file we can only read, but not write to. To do this, we will issue three commands in this step:
C:\>ATTRIB –H C:\BOOT.INI <enter>
C:\>ATTRIB –R C:\BOOT.INI <enter>
C:\>ATTRIB –S C:\BOOT.INI <enter>
Now that we’ve modified the attributes for the BOOT.INI file, it’s up for deletion.
The syntax for it is simple: { DEL | FILE NAME }
C:\>DEL BOOT.INI <enter>
Now for the most important step of our process, the BOOTCFG /REBUILD
command which searches for pre-existing installations of Windows XP and rebuilds essential components of the Windows operating system, recompiles the BOOT.INI file and corrects a litany of common Windows errors. It is very important that you do one or both of the following two things: First, every Windows XP owner must use /FASTDETECT as an OS Load Option when the rebuild process is finalizing. Secondly, if you are the owner of a CPU featuring Intel’s XD or AMD’s NX buffer overflow protection, you must also use /NOEXECUTE=OPTIN as an OS Load Option. I will demonstrate both commands for the purpose of this guide, but do not set NOEXECUTE as a load option if you do not own one of these CPUs. For the “Enter Load Identifier” portion of this command, you should enter the name of the operating system you have installed. If, for example, you are using Windows XP Home, you could type “Microsoft Windows XP Home Edition” for the identifier. This gives the process some authenticity, if you’re keen on being a perfectionist.
C:\>BOOTCFG /REBUILD <enter>
Add installation to boot list? Type Y <enter>
Enter Load Identifier: Type Windows XP blah blah blah <enter>
Enter OS Load Options: Type /fastdetect /noexecute=optin <enter>
This step verifies the integrity of the hard drive containing the Windows XP
installation. While this step is not an essential function in our process, it’s still good to be sure that the drive is physically capable of running windows, in that it contains no bad sectors or other corruptions that might be the culprit. No screenshot necessary here!
C:\>CHKDSK /P /R
Let it proceed; it could take in excess of 30 minutes on slower computers, when this is finished move on to the seventh and final step.
This last step also requires no screenshot.
C:\>FIXBOOT
This writes a new boot sector to the hard drive and cleans up all the loose ends we created by rebuilding the BOOT.INI file and the system files. Windows Recovery Console will ask
Are you sure you want to write a new bootsector to the partition C:
Type “Y” <enter>
Type EXIT <enter>
With any luck, your PC will boot successfully into Windows XP as if your various DLL, Hive, EXE and NTLDR errors never existed. You’ve just saved yourself from many hours of work, frustration, potential data loss and shelling out your hard-earned greenbacks at a brick’n’mortar operation.
Keep in mind that this solution is only designed to resolve the issues introduced in the preface. If the machine is heavily infected with spyware and viruses, you should extract your data and format the drive for a fresh install.
If you wish to install the Recovery Console as boot option, here is the MS link
hxxp://support.microsoft.com/kb/307654/
Best Wishes