Home  │  Lock Registry I  │  Lock Registry II  │  Reg.exe


How to import a *.reg file into the registry

Revised and expanded 22 Mar 2005

Topics in this article:

[1] Reg file

[2] Reg file format

[3] Reg versus hive file

[4] Importing reg file

[5] Unlocking the registry

[6] Other methods to edit the registry


1. Reg file

A *.reg file is a plain text file that is associated with the Windows registry editor. The registry editor in Windows XP, regedit.exe is an updated version and combines the features of the old regedit.exe and regedt32.exe in Windows 2000.

You can make one in any text editor such as Notepad and save as reg (File, save as, all files) or export it directly from an existing registry key in the registry editor in: File > Export, reg. To reduce errors, export a key and edit it.


2. Reg file format

Windows XP exports reg files with the Windows Registry Editor version 5.0 heading; this uses unicode. Older versions uses Regedit 4 and uses ANSI. Windows XP supports both formats but version 5 is not supported in older versions of Windows. Reg files can add, change or delete registry keys and can be used in scripts. To find out about the format, export some keys and look inside with Notepad.


3. Reg versus hive file

It is important to note that merging a reg file does not delete those keys which are not referred to in the file and some keys in use by the system cannot be altered. Therefore it is not a foolproof method of backing up the registry. For this purpose, export the registry as a registry hive file instead or use other methods such as system restore.

If you did not make the reg file, before you import it, it is prudent to open it first in Notepad (R click, Edit) and examine its content carefully. If you are not sure what it does, do not import it.


4. Importing reg file

You can open the Registry editor to import the file directly. Go to File > Import and select the reg file.

You can double-click a reg file directly from its directory. When you double-click a *.reg file a Registry Editor window pops up and ask if you want to go ahead unless you have deliberately changed the file association as a security measure (fig. 1).

Registry Editor prompt

Fig. 1. Registry Editor prompt


Click Yes. Another window pops up to confirm that the file has been merged: click OK to finish (Fig. 2). There is no cancel  or go back button so be careful in the previous step.

Registry Editor confirmation message

Fig. 2. Registry Editor confirmation message


Sometimes editing the registry takes effect immediately: this commonly happens with HKCU keys. Other times you need to reboot, or re-logon to your account or reopen explorer.exe in Windows Task Manager and this commonly happens with HKLM but there are exceptions.


5. Unlocking the registry

There is one important limitation with this method: in Windows XP you cannot use this method to unlock the registry if it has been disabled. This has been covered in detail in this article.


6. Other methods to edit the registry

These include:

Group Policy Editor in Windows XP Professional (for policy keys only),
Console Registry editing tool reg.exe,
inf file,
JScript and
Windows installer (msi).

Some have been covered in other tutorials and the rest I hope to cover in due course.



KB 310516

KB 322756

Honeycutt, Jerry, Microsoft Windows XP Registry Guide (Redmond: Microsoft Press, 2003)


Copyright 2003-2005 by Kilian. All my articles including graphics are provided "as is" without warranties of any kind. I hereby disclaim all warranties with regard to the information provided. In no event shall I be liable for any damage of any kind whatsoever resulting from the information. The articles are provided in good faith and after some degree of verification but they may contain technical or typographical errors. Links to other web resources may be changed at any time and are beyond the control of the author. Articles may be added, removed, edited or improved at any time. No support is provided by the author.

This is not an official support page for any products mentioned. All the products mentioned are trademarks of their companies. Edit the registry at your own risk and back up first.

Last updated 22 Mar 2005