Reg Restore - DOS/Command Prompt Reference
[Windows NT series/XP or later] Restores the data saved in a file (hive data) to the specified registry key. This is one of the operations of Reg command.
This page covers commands that allow you to modify the Windows registry. As the registry contains important settings for Windows, please proceed with caution when making changes. It is strongly recommended to create a backup before manipulating the registry, especially if you are not familiar with registry operations. Making inadvertent changes to various data can lead to Windows not starting up properly. Please note that we cannot take responsibility for any issues that may arise from using the information on this page.
* The execution of the command requires backup privileges (SeBackupPrivilege) and restore privileges (SeRestorePrivilege) (usually both are granted to the Backup Operators group). If you are running the command from the Command Prompt and it doesn't have ‘Administrator’ in the window title, you may need to open Command Prompt with elevation, such as by selecting ‘Run as Administrator’.
Syntax
reg[.exe] restore <key> <file-name> [/reg:[32|64]]
* The parameters are specified in the order of ‘key’ and then ‘file’, not ‘file’ and then ‘key’.
Options
<key> |
Specifies the key name. For specific instructions on how to specify the key name, please refer to ‘About specifying key names’. However, this command can only operate on keys for the local computer. The key name is specified with the complete path, and if the key does not exist, an error will occur. Furthermore, if the specified key already contains content, it will be entirely deleted and overwritten. |
<file-name> | Specifies the file name of the data to be loaded. |
/reg:[32|64] |
If there is an environment with both 64-bit and 32-bit versions (WOW64), specifying ‘/reg:32’ will reference registry data used by 32-bit applications (for example, ‘HKLM\Software\WOW6432Node’ for HKLM), and specifying ‘/reg:64’ will reference registry data used by 64-bit applications. If this option is omitted, the executed Reg.exe will reference the registry corresponding to its bit version. If it is a 64-bit version, it will reference the 64-bit registry; if it is a 32-bit version (located under %SystemRoot%\SysWOW64), it will reference the 32-bit registry. If you want to reference registry data for a specific application and know whether it's 32-bit or 64-bit, you can explicitly specify this option to avoid ambiguity. * Even if Reg.exe is a 32-bit version, you can reference the 64-bit registry by using ‘/reg:64’. |
Details
The ‘RESTORE’ command in Reg is used to restore values and keys from the registry saved in hive data. Unlike loading with Reg Import, it completely replaces the content and state of the specified key with what is written in the hive data. Therefore, any existing data in the specified key will be lost, and information such as access permissions will be applied from the content written in the hive data.
* Therefore, Reg Restore is a powerful command used for registry restoration purposes, and as mentioned earlier, it requires permissions for backup and restoration that are typically not available to regular users.
Note that hive data differs from files with the ".reg" extension and is primarily created with Reg Save.
Samples
Sample
reg add "HKLM\Software\My Company" /f reg restore "HKLM\Software\My Company" MyCompany_key.dat
Restores the data from the ‘MyCompany_key.dat’ file to the ‘HKEY_LOCAL_MACHINE\Software\My Company’ key. The key must already exist, so it is created beforehand using Reg Add.