If you are about to change a Windows Registry value or key, first export the smallest parent key that contains the change to a .reg file. If the change causes a problem, import that file to put its saved values back. This guide applies to supported Windows 10 and Windows 11 installations and uses Registry Editor (regedit) plus optional command-line methods. A registry-key export is useful for targeted rollback, but it is not a complete PC backup and an imported .reg file generally adds or overwrites saved values without deleting newer values that were added later.

Prerequisites and compatibility​

  • Sign in with an account that has administrator rights when the key is under HKEY_LOCAL_MACHINE (HKLM) or when Windows prompts for elevation.
  • Know the exact registry path and value you plan to change. Do not export an entire top-level hive such as HKEY_LOCAL_MACHINE unless you have a specific reason; the file can be very large and difficult to restore safely.
  • Close the app, service, or Settings page related to the change before exporting or restoring the key.
  • Create a dedicated folder for backups, such as:
    C:\RegistryBackups
  • Use a descriptive file name that includes the feature and date, for example:
    C:\RegistryBackups\WiFiPolicy-before-change-2026-07-22.reg
Warning: Registry files can contain account names, application configuration, network paths, and other sensitive information. Keep them in a protected local folder, encrypted drive, or other secure backup location. Do not download and run .reg files from untrusted sources.

Primary procedure: Back up a registry key with Registry Editor​

  • Identify the exact key to be changed.
    A registry path normally begins with one of these root keys:
    Code:
    HKEY_CURRENT_USER
    HKEY_LOCAL_MACHINE
    HKEY_CLASSES_ROOT
    HKEY_USERS
    HKEY_CURRENT_CONFIG
    For example, if instructions tell you to change:
    HKEY_CURRENT_USER\Software\Contoso\App
    back up App before editing anything beneath it. If you will change several values in App, exporting that key captures the key, its values, and all subkeys below it.
  • Open Registry Editor.
    Windows 11
  • Select Start.
  • Type Registry Editor.
  • Select Registry Editor from the results.
  • Select Yes if User Account Control asks whether to allow the app to make changes.
Windows 10
  • Select Start.
  • Type regedit or Registry Editor.
  • Select Registry Editor.
  • Select Yes at the User Account Control prompt, if shown.
You can also press Windows key + R, type:
regedit
and then select OK.
Expected result: Registry Editor opens with a tree of root keys in the left pane.
  • Navigate to the key you will modify.
    Expand the folders in the left pane, following the exact path one part at a time.
    For example, to reach:
    HKEY_CURRENT_USER\Software\Contoso\App
    expand:
    Code:
    HKEY_CURRENT_USER
    └─ Software
       └─ Contoso
          └─ App
    Select the final key, such as App. Its values appear in the right pane.
  • Export the key before making the change.
    With the target key selected:
  • Select File > Export.
  • Choose a secure backup folder, such as C:\RegistryBackups.
  • Enter a descriptive file name ending in .reg, for example:
    App-before-enable-test-setting-2026-07-22.reg
  • Under Export range, select Selected branch.
  • Confirm that the displayed branch is the key you selected, for example:
    HKEY_CURRENT_USER\Software\Contoso\App
  • Select Save.
Expected result: A .reg file is created in the selected folder. The file contains the selected key, its values, and its subkeys.
  • Confirm that the backup is usable.
  • Open File Explorer and browse to the backup folder.
  • Verify that the .reg file exists and has a nonzero size.
  • Right-click the file and select Edit only if you need to inspect it. Do not make edits unless you understand registry-file syntax.
  • In Notepad, confirm the file begins with:
    Windows Registry Editor Version 5.00
  • Close Notepad without saving changes.
Expected result: The file names the intended registry branch and can be retained as the rollback copy.
  • Make only the planned registry change.
    Return to Registry Editor and make the specific value or key change you intended.
  • To edit an existing value, double-click it, change only the required data, and select OK.
  • To create a value, right-click an empty area in the right pane, select New, choose the required value type, name it exactly as instructed, and enter the required data.
  • To remove a value or key, select it and press Delete only when the instructions explicitly require deletion.
Warning: Do not delete or rename registry keys outside the exact path you backed up. Changes to keys controlling sign-in, services, networking, storage drivers, BitLocker, startup, or boot configuration can prevent normal Windows operation. If you are changing one of those areas, create a System Restore point as described in the alternate method before proceeding.
  • Apply the change as required.
    Registry changes do not always take effect immediately. Follow the instructions associated with the change:
  • If the instructions say to restart Windows, save work and restart.
  • If the instructions say to sign out, sign out and sign back in.
  • If the change affects a particular app, close and reopen that app.
  • If the change affects a Windows service, restart only that service if the instructions specifically identify it.
Expected result: The intended feature, policy, app behavior, or setting changes after the required refresh action.

Verification of success​

  • Reopen Registry Editor and return to the modified key.
  • Verify that the value name, value type, and value data match the planned change.
  • Test the feature affected by the change. For example:
  • Open the affected application.
  • Check the relevant Windows setting.
  • Confirm a policy or restriction behaves as expected.
  • Restart the app or computer if the change requires it.
  • Keep the .reg file until you have used the system normally long enough to confirm the modification is stable.
For a simple documentation trail, create a text file in the same backup folder recording:
Code:
Registry path:
Changed value:
Original setting:
New setting:
Date:
Restart or sign-out required:
This makes it easier to identify the correct rollback file later.

Restore a registry-key backup from a .reg file​

Use this method when the change has an unwanted effect but Windows still starts and you can sign in.
Warning: Importing a .reg backup changes the registry immediately after confirmation. Close the affected application or stop the related work first. Import restores the values recorded in the file, but it may not remove values or subkeys that were created after the backup. If your test added new values, remove those new values separately only after confirming they belong to your test.
  • Locate the backup .reg file in File Explorer.
  • Right-click the file and select Merge.
  • If User Account Control appears, select Yes.
  • When Registry Editor warns that adding information can unintentionally change or delete values, verify that:
  • The file is your own backup.
  • The file name and date are correct.
  • The file corresponds to the key you changed.
Select Yes.
  • Wait for the confirmation stating that the keys and values have been successfully added to the registry.
  • Select OK.
  • Repeat the same refresh action required for the original change:
  • Restart Windows if the change was system-wide or if you are unsure.
  • Otherwise, sign out and back in, or reopen the affected app as appropriate.
Expected result: The saved values are written back to the original registry path.

Restore from inside Registry Editor​

If file associations or the Merge option are unavailable:
  • Open Registry Editor.
  • Select File > Import.
  • Browse to the backup .reg file.
  • Select the file, then select Open.
  • Accept the confirmation prompts.
  • Restart, sign out, or reopen the affected app as required.
Registry Editor File menu with Import available.

Alternate method: Use Command Prompt for repeatable exports and imports​

The command-line method is useful when you want an exact command in a change record, need to back up the same key on several PCs, or cannot conveniently use the Registry Editor interface.
  • Create the backup folder:
    mkdir C:\RegistryBackups
  • Open an elevated Command Prompt when working with a protected system key:
    Windows 11
  • Right-click Start.
  • Select Terminal (Admin).
  • Select Yes at the User Account Control prompt.
  • Open a Command Prompt tab if Terminal opens PowerShell.
Windows 10
  • Right-click Start.
  • Select Windows PowerShell (Admin) or Command Prompt (Admin), depending on the installation.
  • Select Yes at the User Account Control prompt.
  • Export the specific key. For example:
    reg export "HKCU\Software\Contoso\App" "C:\RegistryBackups\App-before-change.reg"
    For a protected system-wide key, use the same format with HKLM, for example:
    reg export "HKLM\SOFTWARE\Contoso\App" "C:\RegistryBackups\App-before-change.reg"
    Expected result: The command returns to the prompt without an error and creates the .reg file. A return code of 0 indicates success.
  • To restore the exported file later, run:
    reg import "C:\RegistryBackups\App-before-change.reg"
    Expected result: The command returns to the prompt without an error. A return code of 0 indicates success. Restart or sign out if the affected setting does not update immediately.

Troubleshooting and rollback/escalation​

“Cannot export” or “Access is denied”​

This usually means the selected key is protected or your current session is not elevated.
  • Close Registry Editor.
  • Open Registry Editor using Run as administrator.
  • Try the export again.
  • If you still cannot export, do not take ownership of or loosen permissions on a system key merely to make a backup. Stop and confirm the instructions are correct for your Windows version and account type.
For command-line export, use an elevated Command Prompt or Terminal session and verify that the destination folder is writable.

The backup file is empty, missing, or has a size of 0 KB​

Do not proceed with the registry change.
  • Confirm you chose Selected branch, not an unintended export range.
  • Confirm the folder where you saved the file; File Explorer may be displaying a different folder than expected.
  • Save the export under a new name in C:\RegistryBackups.
  • Verify the .reg file exists and begins with Windows Registry Editor Version 5.00.

Import says the file is not a registry script​

The file may be corrupted, renamed incorrectly, or not actually a .reg export.
  • Right-click the file, select Properties, and confirm its type is a registration entries file.
  • Open it in Notepad and confirm that the first line is:
    Windows Registry Editor Version 5.00
  • If it does not have that header, do not import it.
  • Use another known-good backup or create a fresh export before making further changes.

Import succeeds, but the problem remains​

A successful import only confirms that Windows accepted the registry entries. The change may require a restart, or the problem may involve values that were not part of the backup.
  • Restart Windows first.
  • Recheck the target key in Registry Editor to confirm the saved values returned.
  • Look for values or subkeys created during the test; a .reg import normally does not remove these automatically.
  • If you know exactly which new test value was added, delete only that value and restart again.
  • If the original registry change affected a service, driver, networking stack, security feature, storage configuration, or startup behavior, use System Restore instead of continuing to edit unrelated registry keys.

Windows will not start normally after a registry change​

Do not keep applying registry files blindly.
  • Start Windows Recovery Environment by interrupting startup three times, or use the recovery options available on the sign-in screen.
  • Select Troubleshoot > Advanced options > System Restore.
  • Choose a restore point created before the registry change.
  • Follow the prompts to restore system files, installed drivers, registry configuration, and settings to that point.
  • If no restore point exists and the device is managed by an organization, contact the organization’s IT administrator before attempting further recovery steps.
 

Last edited: