Many of the posts that I have written involves some modification in the Windows Registry. Windows Registry is the information repository about all the hardware and software components of a computer. This is one of the most important component of the windows operating system and any kind of wrong entry in the registry can lead to corruption of whole system. Wrong entries or deleted entries in registry is one of the main reason for the corruption of windows. Hence, it becomes very vital to know how to take regular backups of windows registry and how to restore these backups when needed.
Backup and restore Windows Registry
- When you know to which part of the registry you are making changes, it is better to take a backup of only that segment of registry. In case anything goes wrong, you can restore that particular segment.
- Launch the Run program by pressing Win key + R from your keyboard and type regedit. Hit enter and this will open the Registry Editor. Now, suppose you are making some modifications in the HKEY_CURRENT_USER\SOFTWARE\Policies . So we need to take backup of only this portion of the registry.
- To do this, right click on the Policies folder and select Export. Save the file after selecting the location and naming the file.
- The file will be saved with .reg extension. If anything goes wrong, it is most likely that it is due to that portion of registry. So, in order to restore the backup, just double click on the saved .reg file and a warning message will show up. Click on Yes and the backup will be restored for that particular entries.
- Similarly, you can create a backup of the entire registry by selecting the Export option available in the File menu. But there is a problem associated with the backup of the entire windows registry. You can create a backup copy of entire registry by Export option, but you cannot import the full backup copy. If you try to import the full backup, the system will give error. This is because windows registry contains entries of many programs that are running continuously and restoring them not possible without stopping them.
- Still, there is an advantage in taking whole backup of the registry. You can open the saved backup in notepad or in some other text editor and use it as reference in case anything goes wrong.
- There is another way to take backup of registry. Instead of taking backup of individual entries you can take backup of registry files. The registry files are contained in the C:\Windows\System32\config folder. So we need to take a backup of this folder.
- Again, here also we cannot copy this config folder directly as the registry files are in use. To copy the contents of the config folder follow these steps:
Backup Registry files with Command prompt
- In windows 10, go to Settings and then select Update and Security. Then select Recovery from the list and under Advanced startup click Restart now.(Save your work before restarting)
- After restarting, select the Command prompt option and provide your System credentials. This will open the command prompt window. Now, you can use command prompt to copy the config folder.
- To copy the contents of the config folder, type the following command and hit enter. In my case, F is the external USB drive to which I want to create a copy of the config folder. Change the letter f to the drive name to which you want to create the backup of registry files.
xcopy .\Config f:\Config\ /h /s /i
- The config folder is copied to the f drive. In case you need to restore these backup files, again launch command prompt from the advanced startup and type the following commands.
xcopy * c:\Windows\System32\Config\
(hit enter and press y when prompt to overwrite the existing files)
So you can use this tutorial for taking backup of registry files when you are going to made some major changes to your computer. In case anything goes wrong, you can restore them and prevent corruption of your system.