The Regedit.exe program is the Windows XP, Windows Server 2003, and Windows 9x Registry Editor. It is also available on Windows 2000, but for Windows 2000 the GUI is unable to edit REG_EXPAND_SZ and REG_MULTI_SZ data types.
Regedit.exe can import and export registry Keys and Value Names using a .reg file.
When you select a Key in Regedit.exe and press Export on the File menu, a dialog box opens for you to name the output file with a Save as type of Registration Files (*.reg). This generates a .reg file with a Windows Registry Editor Version 5.00 header, and any REG_EXPAND_SZ and REG_MULTI_SZ data types are represented as Unicode, double-byte, characters. You can also export a .reg file, using Windows Registry Editor Version 5.00 format, from the command line, by running regedit /e FileName "Key".
You can also use the GUI to Export a .reg file in Win9x/NT4 Registration Files (*.reg) format, by toggling the Save as type. This generates a .reg file with a REGEDIT4 header, and any REG_EXPAND_SZ and REG_MULTI_SZ data types are represented as single-byte characters. You can also export a .reg file, using REGEDIT4 format, from the command line, by running regedit /a FileName "Key".
You can import a .reg file, using the GUI, by selecting Import from the file menu, and selecting a File name. If your .reg file contains \[HKEY_LOCAL_MACHINE\SOFTWARE\AAA\BBB\CCC\], the HKEY_LOCAL_MACHINE\SOFTWARE\AAA, HKEY_LOCAL_MACHINE\SOFTWARE\AAA\BBB, and HKEY_LOCAL_MACHINE\SOFTWARE\AAA\BBB\CCC sub-keys are added, if necessary. Any Value Names in the .reg file are either added, or if they exist, replaced, in both data type and data value.
If a key in a .reg file is preceeded by a minus sign (\[-Key\]), the key, its' sub-keys, and Value Names are deleted.
If a "ValueName"=- line is present in a .reg file, the Value Name is deleted.
You can import a .reg file from the command line by running regedit filename.reg, or silently, by running regedit /s filename.reg. When importing, you can use any extension, like .txt or .tmp, not just .reg files, as long as the data in the file uses the correct syntax. To import from Windows Explorer, right-click the .reg file and press Merge.
Assume that your registry contained a HKEY_LOCAL_MACHINE\SOFTWARE\AAA Key with the following Value Names, data types, and data values:
Value Name Data Type Data Value
String REG_SZ A Sting
Dword REG_DWORD 10 (in decimal)
Binary REG_Binary 01020304
MultiString REG_MULTI_SZ Line 1
ExpandableString REG_EXPAND_SZ %SystemRoot%
1. The data value of REG_DWORD data types are expressed in hexadecimal.
2. REG_BINARY data types are indicated by hex:.
3. REG_MULTI_SZ data types are indicated by hex(7):.
4. REG_EXPAND_SZ data types are indicated by hex(2):.
5. Hex lines are continued by using a trailing \.
6. REG_MULTI_SZ data type have line breaks indicated by 00, for REGEDIT4 format, and 00,00, for Windows Registry Editor Version 5.00 format.
7. All hex lines use hexadecimal encoding, as in the following example:
% S y s t e m R o o t %