How to Back Up and Restore the Windows Registry

The Windows registry is a database that contains important, machine-specific settings and information regarding almost everything in your computer — preferences, applications, users, attached devices and so on. The registry contains two basic elements: keys and values. The Windows operating system is constantly referring to the registry; for example, to open a program, install new software or change your hardware, Windows must check the values of certain keys.

A registry file can become corrupted due to malware or issues, which can lead to poor performance or even the operating system crashing. To ensure you can recover from corruption, you should back up your  reg files regularly. So let’s find out how to make an entire registry backup and restore the registry in Windows.

Making a Windows Registry Backup

Back up the Windows Registry Using Regedit

Back up your registry regularly, and also before you attempt to change, create or remove registry settings or hives, or install new system drivers, so you can revert to a known good version if something goes wrong. Follow these steps to create a backup:

  1. Press the Windows button and the R button simultaneously to open the Run window.
  2. Type “regedit” to open the registry editor and press Enter.
  3. Click File > Export.
  4. In the dialogue box, enter a name for the backup file (for example “rgbkp2018”), select the location where you want to export registry file and click Save to create and save the backup.

Making a Windows Registry Backup

Backing up the Windows Registry Using the Command Prompt

You can export registry records by typing reg export and a particular registry root key at the command prompt. To export multiple keys, you can use a script like the following:

reg export HKCR C:\RegBack\HKCR.Reg /y

reg export HKCU C:\RegBack\HKCU.Reg /y

reg export HKLM C:\RegBack\HKLM.Reg /y

reg export HKU C:\RegBack\HKU.Reg /y

reg export HKCC C:\RegBackHKCC.Reg /y

You can also back up your registry automatically with third-party registry cleaning software like CCleaner Registry Cleaner; you can find more about top free tools in the article “How to Perform Windows Registry Repair.”

Restoring the Windows Registry

You can restore your registry in several different ways. Here are the most common methods:

  • From Safe Mode
  • From the command prompt
  • Using System Restore
  • Using Automatic Repair
  • Using System File Checker
  • By resetting the PC
  • Using the DISM command
  • By reinstalling Windows from scratch

How to Restore a Registry Backup from Safe Mode

This is the most basic method. First, boot Windows in Safe Mode by pressing the F8 button while turning your computer on. When you boot in Safe Mode, Windows loads a minimal environment that helps ensure a stable system and protect vital files and drivers from corruption. Once you’ve booted into Safe Mode, perform the following commands:

  1. Press the Windows button and the R button simultaneously to open the Run window.
  2. Type “regedit” and press Enter.
  3. Click File > Import to import a registry file.
  4. In the Import Registry dialogue box, browse to the location where you saved the file of your backup and click Open.

How to Restore a Registry Backup from Safe Mode

Alternatively, a slightly quicker method is to browse to the location with the backup, right-click the file and select Merge. The file will be automatically imported to your registry.

How to Restore a Registry Backup from Safe Mode The Merge Feature

How to Restore the Registry from the Command Prompt

In some situations, the Windows system will not boot into Safe Mode, so you need to manually restore your registry from the command prompt. To do this, you’ll need your original Windows OS disk or an ISO image on the bootable flash drive with your Windows operating system.

Tap the F8 button before Windows starts and choose Repair My Computer. If F8 doesn’t work, boot from your CD or flash drive by selecting your CD-ROM or flash drive as a primary bootable device in the BIOS and enter the repair Windows mode from there. After booting the Windows OS setup, go to System Recovery and select the command prompt.

We’ll be assuming your Windows directory is located on the C drive. Enter these commands to change your working directory to the directory with your backup:

Cd /d C:\windows\System32\config

xcopy *.* C:\RegBack\

cd RegBack


Then replace the current registry settings with the ones from the backup using these commands:

copy /y software ..

copy /y system ..

copy /y sam ..

Note that the two periods are part of the command.

After this process completes, restart your computer.

How to Restore the Windows Registry with System Restore

You can also restore your computer’s registry using a Windows system restore point. If your computer has System Restore enabled, restore points will be created automatically when major changes are made to the system, such as the installation of new drivers. You can also create restore points manually.

  1. To open the System Restore window, click the Start menu and enter “restore” in the search box.
  2. Select System Restore from the list of results.
  3. Select a restore point. Windows will select the most recent restore point. If the registry corruption has been around for a while, click Show more restore points to see earlier ones. Each restore point will have a timestamp as well as a brief description of why the restore point was created.
  4. Click Scan for affected programs to see all of the programs and drivers that will be deleted from the computer and all programs that will likely not work correctly if you proceed with the restore. A system restore will not affect any of your personal files.
  5. Click Next and then Finish to start the restore process. This may take a few minutes. Your computer will reboot after the restore is complete.

How to Restore the Registry with Automatic Repair

Newer versions of Microsoft Windows, starting from Windows XP, include an automatic repair feature. When you run Automatic Repair, it will attempt to fix corrupt registry keys and repair invalid keys. In Windows 10, take these steps (note that in Windows XP, Windows Vista and Windows 7, the steps might be different):

  1. Open the Settings
  2. Go to the Update & Security section and click
  3. On the Advanced Startup panel, click Restart now.
  4. After the computer reboots, on the Choose an option screen, click Troubleshoot.
  5. On the Advanced Options screen, click Automated Repair.
  6. Choose an account and log in when prompted to do so.
  7. Automatic repair will start. Your computer might reboot during this process.

How to Restore the Registry with System File Checker

Another way to fix a corrupted registry is to run the System File Checker:

  1. Run cmd.exe with administrator rights.
  2. In the command window, type “sfc /scannow and press Enter.
  3. Wait until the scan is complete and then reboot if needed.

How to Restore the Registry by Resetting the PC

Windows 10 allows you to reset your computer and leave all your files untouched. This option completely refreshes your system files and may help with restoring the registry after a system crash. Here are the steps to follow:

  1. Go to Settings and click Update and Security.
  2. Select
  3. In the Reset This PC section, click Get Started and then click Keep My Files.
  4. Click Next twice and then click Finish.

Perform a Registry Restore with the DISM Command

  1. Run cmd.exe with administrator rights.
  2. Run the following command: DISM /Online /Cleanup-Image /ScanHealth
  3. Wait until the scan process completes.

Reinstalling Windows from Scratch

If these methods didn’t fix your registry problems, then you probably will have to reinstall Windows from scratch, which will reset the registry to factory settings.


You should back up your registry on a regular schedule and before any major change so you can restore it if the installation of a program, driver or device causes issues. It is also important to track changes to your registry entries to quickly spot registry corruption. In particular, malware often changes registry startup keys so it will start automatically after each reboot. You can learn more about tracking Windows Server registry changes in this guide about detecting modifications to startup items in the Windows registry.

Jeff is a Director of Global Solutions Engineering at Netwrix. He is a long-time Netwrix blogger, speaker, and presenter. In the Netwrix blog, Jeff shares lifehacks, tips and tricks that can dramatically improve your system administration experience.