How to restore a corrupt Windows XP registry
Every now and again, you come across a machine that has the registry die completely, coupled with an error message along the lines of
Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM
To restore the registry is relatively easy albeit drawn out, providing Windows Restore is enabled.
- Insert the Windows XP boot CD and boot off it.
- Press ‘R’ to enter the recovery console
- Select the Windows instance you wish to repair (remember to type the number and not just hit enter)
- Make a temp directory by typing “md tmp”.
- Create a backup of the current Windows registry by typing the following commands:
- copy c:\windows\system32\config\sam c:\windows\tmp\sam.bak
- copy c:\windows\system32\config\security c:\windows\tmp\security.bak
- copy c:\windows\system32\config\system c:\windows\tmp\system.bak
- copy c:\windows\system32\config\software c:\windows\tmp\software.bak
- copy c:\windows\system32\config\default c:\windows\tmp\default.bak
- Delete the current Windows registry by typing the following commands:
- delete c:\windows\system32\config\sam
- delete c:\windows\system32\config\security
- delete c:\windows\system32\config\system
- delete c:\windows\system32\config\software
- delete c:\windows\system32\config\default
- Copy the Windows repair registry by typing the following commands:
- copy c:\windows\repair\sam c:\windows\system32\config\sam
- copy c:\windows\repair\security c:\windows\system32\config\security
- copy c:\windows\repair\system c:\windows\system32\config\system
- copy c:\windows\repair\software c:\windows\system32\config\software
- copy c:\windows\repair\default c:\windows\system32\config\default
- The type ‘exit’ to reboot the computer.
- Get into safe mode by pressing F8 before the Starting Windows screen comes up.
- Log in as Administrator
- Open My Computer and then the C drive
- Click on Tools > Folder Options
- Under the ‘View’ tab, select ‘Show hidden files and folders’ and uncheck ‘Hide protected operating system files’
- Close the Folder Options window
- Open the System Restore folder (if you cannot open the folder, please use this link to find out how to unlock it: http://support.microsoft.com/kb/309531/)
- Open the ‘_restore{lotsofnumbers}’ folder that is not the current time (use detail view)
- Inside the ‘_restore’ folder, select a recent ‘rp{number}’ folder, these are your restore points, use detail view for dates.
- Inside the ‘rp{number}’ folder, open the ‘snapshots’ folder
- Copy the following files to c:\windows\tmp
- _REGISTRY_USER_.DEFAULT
- _REGISTRY_MACHINE_SECURITY
- _REGISTRY_MACHINE_SOFTWARE
- _REGISTRY_MACHINE_SYSTEM
- _REGISTRY_MACHINE_SAM
- Navigate to c:\windows\tmp and rename the files to the following:
- DEFAULT
- SECURITY
- SOFTWARE
- SYSTEM
- SAM
- Reboot the computer
- Using the boot CD, get back into the Recovery Console as described above
- Run the following commands to delete the repair registry:
- del c:\windows\system32\config\sam
- del c:\windows\system32\config\security
- del c:\windows\system32\config\software
- del c:\windows\system32\config\default
- del c:\windows\system32\config\system
- del c:\windows\system32\config\sam
- Run the following commands to restore the registry you copied from the restore point:
- copy c:\windows\tmp\software c:\windows\system32\config\software
- copy c:\windows\tmp\system c:\windows\system32\config\system
- copy c:\windows\tmp\sam c:\windows\system32\config\sam
- copy c:\windows\tmp\security c:\windows\system32\config\security
- copy c:\windows\tmp\default c:\windows\system32\config\default
- copy c:\windows\tmp\software c:\windows\system32\config\software
- Type ‘exit’ to reboot the computer with the restored registry.
You have now manually restored your Windows XP registry! On a previous attempt at this a machine did need to re-activate with Microsoft, so ensure that you have an active internet connection or a phone handy in order to activate before you log on.
Update (2011/06/12) – To make your life easier, after step 10, open up System Restore from Start > Programs > Accessories > System Tools (or select the option when prompted), and restore to the previous restore point available. If you want to show off though, by all means use the above.


