Any corrupted entries will cause a lot of system problems. Installing unknown applications, manually changing entries, and malware infections can corrupt the registry.
We recommend backing up the registry before updates or making any big changes to your system. You can use some inbuilt tools on your computer to do so. It is also possible to use the command-line interface to avoid the hassle of navigating through the GUI.
How to Create a Backup of Registry
There are a few methods for backing up the registry. Usually, you can use the Registry Editor for selective backups or Task Scheduler and System Restore tool for full backups.
Export Using Registry
There are ways to use the Registry Editor to backup the complete registry. However, doing so and restoring from the backups is somewhat tricky.
You can export the registry keys as REG or hive files.
Before You Begin
REG files are readable text files for exporting and importing registry keys. You can view and edit its contents through a text editor. It is possible to directly merge these files with your registry to change its settings. You can backup your entire registry in a REG file, but there may be issues while restoring the backup.
Hives are database files that contain keys, sub-keys, and values in the registry. You can only view and edit them through the registry editor. They also include the permissions associated with registry entries. So, it’s always better to export the entire registry as hives.
Export as Registry Entries (.reg)
You can directly export registry keys or sub-keys to REG files from the Registry Editor. Here’s how you can do it:
- Launch the Run tool and enter regedit to open the Registry Editor.
- Navigate to any branch you want to backup.
- Click on File after selecting the branch key or right-click on the key and choose Export.
- Please make sure that the Export range option is set to Selected branch.
- Pick the location and the name for the save file. Then click Save to create the backup.
Export as Hive Files
You can find the database files for your system registries inside the
%windir%System32\config directory. The registry databases for user files are in the
- Open the Registry Editor.
- Navigate to the required keys in the Registry Editor and select Export from the File menu.
- Set the Save as type to Registry Hive Files (“.”). Name the files according to the instructions below and choose Save.
The backup files and names you need are:
HKLM\BCD00000000 as BCD-Template HKLM\DRIVERS as DRIVERS HKLM\SAM as SAM HKLM\SECURITY as SECURITY HKLM\SOFTWARE as SOFTWARE HKLM\SYSTEM as SYSTEM HKLM\COMPONENTS as COMPONENTS HKU\.DEFAULT as DEFAULT HKCU\ as NTUSER.DAT HKCU\SOFTWARE\Classes as USRCLASS.DAT
Using these names is required to overwrite registry database files while restoring these backups.
Alternative Method Using Command Prompt
You can also use the command-line interface to export registry keys and entries. You are performing the same operations as above but with the command prompt. Follow the steps below to do so:
- Open the elevated Command Prompt. Search for cmd on the search bar and run Command Prompt as administrator.
- Type the command REG EXPORT “Registry key” “Filename.REG” and press enter. Replace the respective paths accordingly in the command.
If you want to create a backup of your entire registry, you need to use the REG SAVE command.
For instance, REG SAVE HKLM\Drivers D:\DRIVERS /y. You can replace D:\ with the directory path you want. Make sure to create backups for all the keys mentioned in the previous method.
Creating System Restore Point
The System Restore tool allows creating a snapshot of your system as a restore point. You can revert to this point anytime when your system encounters some problem. This tool naturally also backs up your registry. To create a restore point, follow the steps below:
- Go to Settings>System>About.
- Click on System protection from under Related settings.
- Here, click on Create to start the process. Type the description you want and choose the Create option.
- Wait for the process to complete.
Use Task Scheduler
The Task Scheduler allows users to schedule and run certain tasks. With this method, you can create a backup for the registry files in the %windir%\System32\configfolder. However, it doesn’t create a backup for the user registry files. Follow these directions to run the registry backup task:
- Launch the Task Scheduler by entering taskschld.msc in the Run tool.
- Navigate to Task Scheduler Library>Microsoft>Windows>Registry.
- Here, right-click on RegIdleBackup and choose Run.
Using Third-party Backup Software
There are some third-party applications that you can use to backup your registry. These applications help avoid the hassle of manually selecting keys for creating backups.
Make sure to read through the reviews and users’ comments for the application before installing it.
Enable Automatic Backup of Registry
Windows automatically backs up the registry by default in the earlier versions. However, you have to enable this setting manually in the newer versions.
You can do so by using the Registry Editor. Follow the steps below:
- Open the Registry Editor as mentioned above.
- Navigate to the location
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Configuration Manager
- Right-click on an empty area and choose New > DWORD (32-bit) Value.
- Set its name as EnablePeriodicBackup and its value as 1. Double click on it to enter the value.
Restart your PC to apply the changes. Please note that the interval between successive backups is ten days.
How to Restore Registry Backup
There are separate ways to restore the registry backup according to the methods used for said backups.
Selective Backup Recovery
Double-click on the backed-up REG files to restore them. You can also go to File > Import in the Registry Editor and select the REG file.
Using System Restore, you can restore your PC to a restore point. Follow these instructions to do so:
- Search for restore and open Create a restore point.
- In the System Protection tab in System Properties, click on System Restore.
- Select the Restore point you created for backup. Then, follow any on-screen instructions.
- Wait for the process to complete.
Hidden Automatic Backup Recovery
You need to use the Command Prompt in Windows Recovery Environment to restore the hidden registry backup in your system. Follow these steps to do so:
- Start PC with Advanced Startup Options. To do so, go to Settings>Update & Security>Recovery. Then under Advanced startup, click on Restart now.
- Select Troubleshoot from the Advanced Options. Select Advanced Options and then Command Prompt.
- Enter the following commands:
dir(this lists out the files and folders inside C:\Windows\System32. Look for config)
copy config backup
dir(If any file shows value 0, you don’t have a registry backup)
copy * ..\*
- Type y for all when prompted to overwrite.
Hive Files Backup Recovery
To restore the hive backups, you can use a similar method as above. You must manually copy all backup files from the hive file locations to the default database location. Follow the steps below:
- Open Troubleshoot>Advanced Options>Command Prompt in the Advanced Startup Options using the above method.
- Paste the following command and press Enter:
copy D:\BCD-Template C:\Windows\System32\Config\BCD-Template /y
- You need to use these commands for all the hive files. Replace D:\ with your backup directory.