Programming Field

Reg Import - DOS/Command Prompt Reference

[Windows NT series/XP or later] Imports the data saved in a file (.reg file). 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.

* Unlike Reg Restore, the execution of this command does not require backup privileges (SeBackupPrivilege) or restore privileges (SeRestorePrivilege).

Syntax

reg[.exe] import <file-name> [/reg:[32|64]]

* There is no need to specify the ‘key’ as an argument; only the ‘file-name’ and additional options need to be specified. This is because the data in the file itself contains the name of the key to which the import is intended.

Options

<file-name> Specifies the file name from which to read the data. Typically, you would specify a .reg file.
/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’.
* If you are using the 64-bit version of Reg.exe, you can also directly specify keys such as ‘HKLM\Software\WOW6432Node’ when referencing the 32-bit registry.

Details

The ‘IMPORT’ command in Reg is used to import registry values and keys saved in .reg files (registration entries files). The key names and value names for the import destination are directly specified in the file, and consequently, the data is imported into the registry on the local computer. Additionally, it is worth noting that the file data cannot include information such as access rights, distinguishing its role from loading with Reg Restore. If the key names from the import content already exist in the registry, they will be sequentially overwritten (without confirmation prompts).

* Combining ‘Reg Save’ and ‘Reg Restore’ is suitable for purposes such as backup and restoration.

The .reg file to be loaded can be output using ‘Reg Export’ or saved using the ‘Export’ command in the ‘Registry Editor’. Additionally, since it is in text format, it can be manually created by hand if the correct format is followed.

* There are several versions of the .reg file format, and data with the format of the initial version (with the file beginning with ‘REGEDIT’) can also be imported. However, the initial version can only use ‘HKEY_CLASSES_ROOT’, making it mostly obsolete and not very useful on current versions of Windows.

Samples

Sample

reg import MySettings.reg

Imports the data from the ‘MySettings.reg’ file. There is no need to prepare by creating the import destination key in advance.

Please note that there won't be a confirmation message during the command execution. If you want to display a confirmation message using the GUI message box, you can use ‘regedit MySettings.reg’ instead (permission elevation through UAC may occur if necessary).