Repairing Windows XP in Eight Commands

Robert Hallock (Thrax) Millions of people across the globe turn off the computer and go to bed 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 to thos most dreaded of errors.

May 17, 2006 7:55 AM ET in Articles,


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 wide, wibbly 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

Allow me to build tension by prefacing the end-all/be-all solution with my background: Having worked for the now-incorporated Geek Squad branch of Best Buy Corporation for the better part of eight months, I have seen dozens upon dozens of systems come through our department with any one of these errors, brought in by customers who are afraid they did something, have a virus, or are in jeopardy of losing their data. Prior to my discovery of an invaluable sequence of commands, our standard procedure was to hook the afflicted drive to an external enclosure, back up a customer’s data and then restore the PC with the customer’s restore discs or an identical copy of Windows with the customer’s OEM license key. If the customer wasn’t keen on the applicable charges for the data backup, we informed them of the potential risks for a Windows repair installation (Let’s face it, they don’t always work right), had them sign a waiver, and we did our best.

Neither of these procedures are cheap in the realm of commercial PC repair, nor do they inspire a tremendous level of confidence in the technician or the hopeful client.


In an effort to expedite our repair time and retain the sanity of myself and other technicians, I received permission to undertake a case study on a variety of PCs currently in service that exhibited any of the aforementioned symptoms, and I took it upon myself to find a better solution. After crawling through the MSKB, Experts Exchange, MSDN and sundry websites all extolling the virtues of a solution to these problems, I only found one that worked, and it has been reliably serving me for the better part of two weeks on seventeen PCs to date.

The process is simple: Get to the Windows Recovery Console for your particular Windows installation, navigate to the root letter of your installation (C: in most cases), issue eight commands, and reboot. The cornerstone of this process is a command called “BOOTCFG /Rebuild” which is a complete diagnostic of the operating system loaded into the recovery console; the purpose of the command is to remove/replace/repair any system files that were preventing the operating system from loading correctly. Amongst the files it fixes are:

  • Windows Hardware Abstraction Layer (HAL)
  • Corrupt registry hives (\\WINDOWS\\SYSTEM32\\CONFIG\\xxxxxx)
  • Invalid BOOT.INI files
  • A corrupt NTOSKRNL.EXE
  • A missing NT Loader (NTLDR)

The command process may apply to other types of blue screens or Hive/HAL/INI/EXE/DLL-related stop errors, but I have not had the luxury of computers in this type of disrepair. The process I am about to outline is virtually harmless, and if you feel you may be able to correct your PC’s boot-time blue screens and stop errors with the sequence, feel free to try.

Let us now begin with a step-by-step instruction for correcting these issues.

Getting to the Windows Recovery Console

  1. Insert your Windows XP CD into your CD and assure that your CD-ROM drive is capable of booting the CD. Configuring your computer to boot from CD is outside of the scope of this document, but if you are having trouble, consult Google for assistance.
  2. Once you have booted from CD, do not select the option that states: “Press F2 to initiate the Automated System Recovery (ASR) tool.” You’re going to proceed until you see the following screen, at which point you will press the “R” key to enter the recovery console:
xp_src_welcome
  • After you have selected the appropriate option from step two, you will be prompted to select a valid Windows installation (Typically number “1″). Select the installation number, (As mentioned, “1″ in most cases), and hit enter. If there is an administrator password for the administrator account, enter it and hit enter. You will be greeted with this screen, which indicates a recovery console at the ready:
xp_src_console

Proceeding With the Repair Functions

  • There are eight commands you must enter in sequence to repair any of the issues I noted in the opening of this guide. I will introduce them here, and then show the results graphically in the next six steps. These commands are as follows:
    • C: CD ..
    • C: ATTRIB -H C:\\boot.ini
    • C:ATTRIB -S C:\\boot.ini
    • C:ATRIB -R C:\\boot.ini
    • C: del boot.ini
    • C: BOOTCFG /Rebuild
    • C: CHKDSK /R /F
    • C: FIXBOOT
  • To “Go up a directory” in computing is to revert back to the directory above the current folder you’re operating in. If, for example, I’m in the C:WINDOWSSYSTEM32 directory, and I want to get at a file in the WINDOWS directory, I would merely type CD .. and I would be taken out of the SYSTEM32 folder and up one level to WINDOWS. We’re going to do the same thing here from the WINDOWS folder to get to the basic root of C:
xp_src_recurse

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
  • C:ATTRIB -R C:\\BOOT.INI
  • C:ATTRIB -S C:\\BOOT.INI

to remove the Hidden, System and Read Only flags.

xp_src_attributes

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 }, e.g., C:DEL BOOT.INI deletes the BOOT.INI file.

xp_src_delete

Now for the most important step of our process, the BOOTCFG /REBUILD command which searches for pre-existing installations of Windows XP and rebuilds sundry 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.

xp_src_rebuild

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! Just type CHKDSK /R /F at the C:> prompt. 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. When you are at the C:> prompt,
simply type 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. When the Windows Recovery Console asks you if you are “Sure you want to write a new bootsector to the partition C: ?” just hit “Y,” then enter to confirm your decision.

Results and wrap-up

It’s time to reboot your PC by typing EXIT in the Windows Recovery Console and confirming the command with a stroke of the enter key. 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 cause is unrelated to spyware and viruses; while I have had significant luck with rebuilding heavily-infected systems in the method I have described, it is not guaranteed. If you believe your PC has affected one of these symptoms due to spyware or viruses, today’s fastest-growing PC nuisance, please do stop by our Spyware/Virus/Trojan Forum to receive first-class assistance in quarantine, removal and repair. Be sure to read the guidelines of our SVT Forum before posting!

Good luck and happy hunting.

39 Comments

  1. satya

    thank q

  2. graverunner

    My comp has just died and undergone this very same problem yesterday. D= Worked completely alright when it coked out with the screen of death the next morning. Am going to try the instructions outlined here but I have a q...
    After typing in '1' 'Which windows admin would you like to log into' command, I get directed to:
    D:\WINDOWS instead of C:\WINDOWS

    Is it possible to still use the solution above if that's the case? Don't want to do anything yet since I'm scared it will further exacerbate the prob. >___<

    Hope someone can answer this!

  3. mahaveer

    at which point you will press the “R” key to enter the recovery console i`m getting Setup did not find any hard disk drives installed in your computer.
    Make sure any hard disk drives are powered on and properly connected to your computer, and that any disk-related hardware configuration is correct. This may involve running a manufacturer-supplied diagnostic or setup program.
    Setup cannot continue. To quit setup, press F3.

  4. Vipin Pattni

    This worked well with some pc based till systems that were showing same symptoms after loading the usb printer driver. Great help, thanks

  5. therain

    Hi , i got the "which windows would you like to log onto" . After that i type "1" . Now instead of going to the command prompt , i get the Blue screen of death ..registry_error stop 0x00000051 ..kindly help me.

  6. Tushon

    graverunner: D:\Windows is probably your CD drive. C: is nearly always the HDD. Your HDD might be toast and not detectable, but perhaps someone else could chime in if I am incorrect.

    mahaveer: Sounds like your HDD is bad (mechanical failure of some sort). Ensure that all the plugs are in the right spot and try the steps again. If you get the same result or hear any clicking, then the HDD is toast.

    Vipin: Glad to hear it worked for you

    therain: That sounds like it is trying to mount parts of your registry that are then making the command prompt bomb out. Not sure what to do there without using a boot disc that can do offline registry fixing (and I'm not going to be able to discuss that because we only support and recommend legal actions here).

  7. neil patel

    hi i have go to the stage of the password and don't know the administrator password please could you help me

  8. Francis Ezeobi

    thanks
    for you help
    francs

  9. wr.kelly001

    You can find answers from this website: www.windowsrecoverys.com

  10. John

    This procedure erases all restore points.
    Still have the BSOD.

  11. Mike

    I tried several other fixes with no luck and this fixed my PC.
    Mike

  12. Rajesh Pandey

    use of screen shot and image make things easy to understand

  13. Anomi Mouse

    Save yourself some steps:

    C: ATTRIB -H -S -R C:\\boot.ini

  14. I mustbedumb

    I tried it twice to fix an emachine . I used their restore disks and it came up with The file Windows/system32/config/system is corrupt or doesnt exist and I went through your process and did it twice with the same result. the recovery console still says the same thing and the computer will not boot

  15. I mustbedumb

    Niel just hit enter for the password

  16. Anmol

    hello there!! Thanks a lot for the procedure....everytime i used to get this error i had to reinstall windows...this save ALOT of time..and ofcourse DATA.. : D

  17. Carlos

    Thanks a lot, that was a life saver!

  18. uma sankar

    hello
    thanks a lot for the idea

  19. Stretch

    Hi Guys,

    At the end of this process, I was left with the option to boot two different, yet identically named versions of "Microsoft Windows XP Professional". To fix this I had to edit my boot.ini file in Windows.

    Just wanted to let people know that they might need to do some additional work not mentioned in this article.

  20. M.Elhassan

    It works just like a charm. Your article saves my day.
    Thank you a lot.

  21. eyelander

    Thank you so much for your clear explanation...just about to undertake these steps to repair a PC which has given me 4 of these errors over the last few years and has had me on on Linux for the last 2 weeks...although maybe that's a good thing! Will report back with the results!

  22. Steve Saltman

    I lost the function of removing software in the control panel add or remove programs. How can I recover that functionality?

  23. 8Man

    are you sure it's CHKDSK /R /F ? That command returns "The parameter is not valid." message.
    CHKDSK /? does not list a /F as a valid parameter, but it does list /P. CHKDSK /R /P does run.

  24. Gyro Gearloose

    -=WARNING!=-

    You need to proofread your text, before publishing it.

    * C: CD ..
    * C: ATTRIB -H C:\\boot.ini
    * C:ATTRIB -S C:\\boot.ini
    * C:ATRIB -R C:\\boot.ini
    * C: del boot.ini
    * C: BOOTCFG /Rebuild
    * C: CHKDSK /R /F
    * C: FIXBOOT

    Watch the typos!

    Also, all you need to do is
    `ATTRIB -RSH file1 file2....filen'

    But worse still,
    YOU FORGOT TO BACK UP THE BOOT.INI with
    `cp boot.ini boot.bak'

    THIS IS IMPORTANT!

    __NEVER__ edit system files without first saving a copy.

    Shame On You!

    I hope you haven't led too many people into screwing their computers into oblivion, like most of the other Geek Squad wanabees have, already.

    HAND.

  25. Gyro Gearloose

    Some Command Line Interpreters
    might need
    "aattrib -r -s -h" (without the quotes)
    instead of
    "attrib -rsh" (without the quotes)
    to clear all the flags. This is true in Windows 2000. YMMV

  26. primesuspect
    Some Command Line Interpreters
    might need
    "aattrib -r -s -h" (without the quotes)
    instead of
    "attrib -rsh" (without the quotes)
    to clear all the flags. This is true in Windows 2000. YMMV

    You're gonna wanna watch those typos.

  27. Gyro Gearloose

    aatrib

    =ouch!=

    I stand corrected.

  28. Gyro Gearloose

    All joking aside:

    Killing your boot.ini and doing a sanity check
    might work, provided the user is not in
    multiboot environment.

    That said: it is NEVER a good idea to delete or modify ANY system file without first backing up the original version.

    A typical multi-boot setup, using ntldr to chainload to grub, might look like this:

    [boot loader]
    timeout=12
    default=multi(0)disk(0)rdisk(0)partition(3)\WINDOWS
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="XP Pro" /noexecute=optin /fastdetect

    c:\bolin="CentOS"

    C:\="WIN 98"

    c:\bodos="DOS622" /win95dos

    c:\CMDCONS\BOOTSECT.DAT="Recovery Console" /CMDCONS

    Should this get deleted or overwritten, it would be nice to have a copy, to manually reconstruct from, if nothing else.

    Summarily blowing away the boot.ini is not a swell idea, in any event.

  29. Mr TRiot

    As far as a "multiboot environment" that's going to be pretty rare considering any PC, no matter what it is will always run better with a single OS rather then 2 or more....

    The people adding multi boot sequences should be tech-savvy enough to figure out the problem on there own or at least be able to google until they find an answer....

    "Searching google for long enough will solve all life's problems"

  30. Tushon
    As far as a "multiboot environment" that's going to be pretty rare considering any PC, no matter what it is will always run better with a single OS rather then 2 or more...

    Ehhh I dont know how valid this is. Maybe partially true, as in the "inner" OSs, those farther in on the disk, will be "slower" but that is only marginally so and if you are using a SSD, I would think that there would be zero performance degradation.

  31. Mr TRiot
    Ehhh I dont know how valid this is. Maybe partially true, as in the "inner" OSs, those farther in on the disk, will be "slower" but that is only marginally so and if you are using a SSD, I would think that there would be zero performance degradation.

    I don't see the point in running multi OS's on one system unless it's a server. Such as one linux based OS for placing product orders and one OS for a work station environment. Even still that's just lazy on the part of the company for not wanting to dish out more $$ for a workstation

    I ran Vista/Ubuntu on my comp for awhile and it just slowed up my boot speed to minutes (typical is 20 seconds or so) and was just generally not as fast as it should of been. I rearranged all files to be as close to the center of the disc to try to improve boot speed and the time it takes for switching OS's. I got maybe a 5% speed increase? Barely worth the effort...

    My opinion stands. Unless you're in a work environment or wanting to "try" a new OS (such as Ubuntu) it's always better to use a single OS rather then two. It'll also save you gigs of space to boot...

  32. gabe luna

    I'm trying the steps outlined above, but I dont remember ever setting a Admin pasword, can anyone help

  33. MarkyO

    When you're using XP Home, there will be no password for the Administrator's account. Simply press ENTER.

    If you're using XP Pro and you have forgotten your admin password, you could reset it. Simply google for "Offline NT Password & Registry Editor"

  34. Thrax
    I don't see the point in running multi OS's on one system unless it's a server. Such as one linux based OS for placing product orders and one OS for a work station environment. Even still that's just lazy on the part of the company for not wanting to dish out more $$ for a workstation

    I ran Vista/Ubuntu on my comp for awhile and it just slowed up my boot speed to minutes (typical is 20 seconds or so) and was just generally not as fast as it should of been. I rearranged all files to be as close to the center of the disc to try to improve boot speed and the time it takes for switching OS's. I got maybe a 5% speed increase? Barely worth the effort...

    My opinion stands. Unless you're in a work environment or wanting to "try" a new OS (such as Ubuntu) it's always better to use a single OS rather then two. It'll also save you gigs of space to boot...

    That's not really true, I'm afraid. A boot sector is a boot sector. Adding another OS shouldn't slow down the OS in the slightest.

    Also, the center of the disk is not the fastest.

  35. Tushon
    That's not really true, I'm afraid. A boot sector is a boot sector. Adding another OS shouldn't slow down the OS in the slightest.

    Also, the center of the disk is not the fastest.

    The mighty cat has spoken.

    I think he had the right motive, wrong idea.

  36. ardichoke
    That's not really true, I'm afraid. A boot sector is a boot sector. Adding another OS shouldn't slow down the OS in the slightest.

    Also, the center of the disk is not the fastest.

    While adding a second OS won't slow down the operation of the OS at all, it can slow boot times down, especially if you wait for the timeout on your bootloader screen instead of hitting enter. Of course this is just being nitpicky (which I excel at).

  37. louise

    Thank You sooooooo Much , that helped 100% .
    God Bless .

    LOUISE

  38. Panda

    Didn't anyone see 8Man 's post?

    > CHKDSK /? does not list a /F as a valid parameter

    there is no F switch. what is the reason behind this? I am on XP SP3 Home Premium

    //combined:

    Okay, after due diligence, I must report that outside sources indicate that the switch F is implied with the R switch, and that F is only applicable in a DOS shell within an active Windows session.

    Dave

    //combined:

    Okay, after due diligence, I must report that outside sources indicate that the switch F is implied with the R switch, and that /F is only applicable in a DOS shell within an active Windows session.

    Dave

  39. Ankit Moradiya

    Thank You So Much.....

Troll-free since 2003 ®

Why ask?