guide · static export
PC · registry

Back Up a Registry Key Before You Edit It

A registry change is one typo away from a machine that will not sign in. Export the exact key, save the full hive when the stakes are high, and know the two different ways back.

by@guidox updated:10/31/26 time:15 min level:Beginner tested on:Windows 11 24H2 works on:Windows 10, Windows 11, Windows Server 2019 tools:Command Prompt as administrator
TL;DR

Export with **reg export** or save the whole hive with **reg save**, quote the key path, and restore with **reg import** or by loading the hive. Export the smallest key that contains your change, never the whole tree by reflex.

Before you start

Requirements

  • Admin rights for HKLM
  • A folder for the backups
  • 15 minutes
Step by step

Instructions

01

Export the key you are about to change

**reg export** writes a .reg text file you can read and diff. Point it at the deepest key that holds the value, because a giant export is slow to review and slow to restore selectively.

New-Item -ItemType Directory C:\RegBackup -Force | Out-Null
reg export "HKLM\SOFTWARE\Vendor\App" C:\RegBackup\app.reg /y
02

Capture the current values as text too

A .reg file is authoritative, but a plain listing is what you read while troubleshooting. Both files together cost nothing and answer different questions.

reg query "HKLM\SOFTWARE\Vendor\App" /s > C:\RegBackup\app-before.txt
Get-Content C:\RegBackup\app-before.txt | Select-Object -First 15
03

Save the full hive when the change is dangerous

**reg save** writes a binary hive, including subkeys a .reg export cannot carry completely. This is the format that also works outside a running Windows, via reg load in the recovery environment.

reg save HKLM\SOFTWARE C:\RegBackup\SOFTWARE.hiv /y
reg save HKLM\SYSTEM C:\RegBackup\SYSTEM.hiv /y
Get-ChildItem C:\RegBackup | Select-Object Name,Length
⚠ warningThe SOFTWARE hive is a few hundred megabytes. Save it to a disk with room, not to a nearly full system partition.
04

Make the change and keep it small

One value per command, with the exact type. A wrong type is the classic silent failure: the value exists, the program reads something else, and nothing looks broken.

reg add "HKLM\SOFTWARE\Vendor\App" /v FeatureEnabled /t REG_DWORD /d 1 /f
reg query "HKLM\SOFTWARE\Vendor\App" /v FeatureEnabled
05

Restore a value or the whole key

**reg import** merges the file back and overwrites the values it contains. For a single value you can also delete it, which returns the program to its built-in default.

reg import C:\RegBackup\app.reg
reg delete "HKLM\SOFTWARE\Vendor\App" /v FeatureEnabled /f
06

Restore a hive only when Windows is not using it

A live hive is locked, so restoring a .hiv means loading it under a temporary name in the recovery environment and copying the branch back, or replacing the hive file offline.

reg load HKLM\TempSoftware C:\RegBackup\SOFTWARE.hiv
reg query HKLM\TempSoftware\Vendor\App
reg unload HKLM\TempSoftware
⚠ warningLoading a hive is read-write. Do not edit the mounted copy casually — every change lands in your backup file.
Troubleshooting

Common issues

reg export fails with access denied

HKLM needs an elevated prompt. Open the terminal as administrator and confirm with whoami /groups that the token is elevated.

The .reg file does nothing on double-click

The merge may be blocked by policy, or the values are under a path that requires elevation. Import it from an elevated prompt with reg import to see the error.

The value is there but the program ignores it

Wrong registry view or wrong type. Check with reg query /reg:64 and /reg:32; 32-bit apps read the redirected Wow6432Node branch.

reg load says the hive is in use

The file is already mounted or Windows is using it. Use a different mount name, or do the restore from the recovery environment where the live hive is not loaded.

FAQ

Frequently asked

.reg file or full hive?

A .reg file for a key you can name, a hive for a branch you cannot (or when Windows will not boot). The .reg file is smaller and human-readable, the hive is complete.

Does System Restore protect the registry?

Yes, but as a whole-machine rollback that also undoes installed programs. A key export is the surgical option.

How to undo this

Import the .reg file you exported, or delete the value you added with reg delete. For hive changes, load the .hiv and copy the branch back, then unload it.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress