Quick answer: Cannot import … Error accessing the registry means Registry Editor couldn’t create or open at least one key in the .reg file, nearly always because your account isn’t allowed to write there. Open Registry Editor as administrator and import the file from File > Import, or run reg import file.reg from an elevated Command Prompt. If it still fails, the key is protected by Windows, by a policy or by security software. Find out which key it is before changing any permissions.
Applies to: Windows 11 and Windows 10, Registry Editor (regedit) and the reg command.
Before you start: a .reg file can change system settings in one click. Only import files from a source you trust, and export the keys it touches first (in Registry Editor, select the key and use File > Export).
In this guide

Why the import fails
A .reg file is a list of keys and values. Registry Editor works through it from top to bottom. When it can’t open or create a key, it shows Error accessing the registry. When the key opens but some values can’t be written, you see Not all data was successfully written to the registry instead. Both have the same causes:
- No administrator rights. Keys under
HKEY_LOCAL_MACHINEandHKEY_CLASSES_ROOTare machine-wide, so a standard user can’t change them, and even an administrator account runs regedit without full rights unless it’s started elevated. Keys underHKEY_CURRENT_USERnormally import fine. - A protected key. Some keys are owned by TrustedInstaller and only Windows’ own servicing can change them.
- A key locked by policy or security software. Policy branches set by your organization, and Microsoft Defender’s settings when Tamper Protection is on, refuse changes even from administrators.
- A key in use. A running service or driver can hold a key open.
Registry Editor doesn’t stop at the first failure, so part of the file may already have been applied. Keep that in mind when you retry.
1. Import with administrator rights
Double-clicking a .reg file and confirming isn’t always enough. Start Registry Editor elevated instead:
- Press Win, type
regedit, then press Ctrl + Shift + Enter (or right-click it and choose Run as administrator). Approve the UAC prompt. - Choose File > Import, select the .reg file and click Open.
Or use the command line, which reports the result clearly. Open an elevated Command Prompt and run:
reg import "C:\Users\you\Downloads\settings.reg"
Microsoft documents the exit code as 0 for success and 1 for failure. If you’re on a standard account, you need an administrator’s password for the UAC prompt; there’s no way around that, and that’s the point of it.
2. Find the key that refuses the write
Open the .reg file in Notepad (right-click it, Open with, Notepad) and look at the key paths in square brackets. Then open the same path in Registry Editor. If you can’t create a test value there, that’s your key.
For a long file, Microsoft’s free Process Monitor (Sysinternals) shows it directly: start a capture, import the file, then filter on Process Name regedit.exe and Result ACCESS DENIED. The path column lists each key that refused.
3. Check whether the key is meant to be locked
Before forcing anything, look at where the key is. In Registry Editor, right-click it and choose Permissions > Advanced to see its owner.
| Key or owner | What it means | What to do |
|---|---|---|
| Owner TrustedInstaller | Protected by Windows Resource Protection | Usually leave it. Changes here can break updates or features |
...\SOFTWARE\Policies\... on a work PC | Set by Group Policy or Intune | Ask IT; your change would be overwritten at the next policy refresh |
| Microsoft Defender keys | Locked by Tamper Protection | Change the setting in Windows Security, not the registry |
| A service’s key | Held open while the service runs | Stop the service first, or import from Safe Mode |
Safe Mode only helps the last case. It doesn’t change permissions, so it won’t unlock a TrustedInstaller or policy key.
4. Change permissions on that one key
Warning: changing the owner of system keys can break Windows features and updates. Only do this on the specific key you found in step 2, never on a whole hive such as HKEY_LOCAL_MACHINE\SOFTWARE, and put the owner back afterwards.
- In elevated Registry Editor, right-click the key and choose Permissions, then Advanced.
- Note the current owner. Next to Owner, click Change, enter Administrators and click OK.
- Back in Permissions, select Administrators, tick Full Control under Allow and click OK.
- Import the .reg file again.
- Restore the original owner: in Permissions > Advanced > Change, enter
NT SERVICE\TrustedInstallerif that was the owner, and remove the Full Control you added.
This is the same idea as fixing folder access denied errors and getting into the WindowsApps folder: take ownership of the one item you need, not the whole tree. Avoid giving Everyone Full Control, and skip third-party registry tools and the built-in Administrator account; they bypass protection without telling you what changed.
Similar errors that have other causes
- The specified file is not a registry script. The file itself is the problem, not permissions. The first line must be
Windows Registry Editor Version 5.00(orREGEDIT4for old files), followed by a blank line. Files edited in some editors get saved as UTF-8 or with a blank first line; open the file in Notepad, fix the first line, and use File > Save As with the encoding set to UTF-16 LE or ANSI. Also check the file isn’t reallysettings.reg.txt. - Registry editing has been disabled by your administrator. That’s the Prevent access to registry editing tools policy under User Configuration > Administrative Templates > System. On a work PC, ask IT. On your own PC, check it in the Local Group Policy Editor (
gpedit.msc, Pro and higher editions); our Group Policy Management Console guide explains how the two tools differ. The policy has an option that decides whether silent imports withregedit /sare blocked too. - The import succeeds but nothing changes. On 64-bit Windows, settings for 32-bit programs live under
HKLM\SOFTWARE\WOW6432Node. If the file targets the wrong one, runreg import file.reg /reg:32or/reg:64to choose the view, or fix the path in the file. Some settings also need a sign-out or restart.
Check the result and undo if needed
Open each key in the file and confirm the values match, or query one from Command Prompt:
reg query "HKCU\Software\Example" /v SettingName
If the change caused problems, import the backup you exported before you started. A .reg file can also delete things: a key written as [-HKEY_...\Key] or a value set to =- removes it, so read the file before you merge it.
Related guides
- How to open Command Prompt as administrator in Windows 11 and 10
- You don’t currently have permission to access this folder: how to fix it
- How to access the WindowsApps folder in Windows 11 and 10
- Group Policy Management Console on Windows 11: how to install and open it
- Microsoft Teredo Tunneling Adapter Code 10: what it means and how to fix it
Official sources:
Leave a Reply