Programming Field

Reg Load - DOS/Command Prompt Reference

[Windows NT series/XP or later] Maps and loads the hive data file containing registry data to the specified registry key location. This is one of the operations of Reg command.

* 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] load <key> <file-name>

* The help for the command may display "/reg:32 | /reg:64," but in practice, it cannot be used (and even if it could, it would have no effect).

Options

<key>

Specifies the key name. For specific instructions on how to specify the key name, please refer to ‘About specifying key names’.

The key name specified here is limited to only the root keys HKEY_LOCAL_MACHINE or HKEY_USERS. Additionally, only subkeys directly under HKEY_LOCAL_MACHINE or HKEY_USERS can be specified, and the key must not exist at the time of command execution.

<file-name> Specifies the file name that holds the data.

Details

The ‘LOAD’ command in Reg loads hive data into the registry tree, making it treat the data as part of the registry (sometimes referred to as ‘loading a hive’). It can be used to load and utilize data created by Reg Save. Additionally, it can be used for purposes such as temporarily loading and maintaining user-specific registry data (NTUSER.DAT for each user) or system configuration data (e.g., %SystemRoot%\System32\Config\Software) for maintenance when there are abnormal behaviors in Windows.

Originally, the registry is configured by the system through a combination of loading hives. For example, the ‘HKEY_USERS\.DEFAULT’ key is a registry key loaded from the file ‘%SystemRoot%\System32\config\DEFAULT’. In a special case, the ‘HKEY_CURRENT_USER’ key is a registry key loaded from the ‘NTUSER.DAT’ file in the current user's home directory. Since these are managed by the system, unloading during Windows runtime or reloading to a different registry location is not possible. However, it is possible to load hive data from the system registry on a computer that is not running Windows or load user-specific hive data for users who are not currently logged in, allowing manipulation in the current environment.

* When loading hive data automatically created by the system, caution is required in handling it. Making changes or deletions to the data without care may lead to unexpected issues when the system attempts to use the original file again. It is recommended to take a backup before loading such data to ensure that you can revert to a stable state if needed.

The loaded hive data file is always in an open state by the system, making it inaccessible for read/write or deletion by other processes (programs). Additionally, if there is any writing to the data under the registry keys mapped by the loaded hive, the changes will be reflected in the file from which the data was loaded.

* The exact timing of the changes being reflected in the actual file is unconfirmed.
* If you attempt to load a hive data file into the same registry key that has already been loaded, the operation will complete successfully without any changes.
* Reg Load only targets the local computer. (The Win32API's ‘RegLoadKey’ function, depending on the invocation procedure, can load hive data from a remote computer onto the registry of the remote computer.)

The data loaded can be unloaded using Reg Unload.

Samples

Sample

reg load HKLM\RepairData Backup\ako\MyCompany_Key.dat

Reads the file ‘Backup\ako\MyCompany_Key.dat’ and makes it treatable as registry data under ‘HKEY_LOCAL_MACHINE\RepairData’.