Programming Field

Reg Copy - DOS/Command Prompt Reference

[Windows NT series/XP or later] Copies the 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.

Syntax

reg[.exe] copy <src-key> <dest-key> [/s] [/f] [/reg:[32|64]]

Options

<src-key>

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

The key name is specified with the complete path, and if the key does not exist, an error will occur.

<dest-key>

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

The key name is specified with the complete path, and if the key does not exist, it will be created along with any intermediate subkeys.

/s Copies all subkeys and their contained values within <src-key>.
/f If a value with the same name exists in the destination, overwrites without prompting when /f is specified. If /f is omitted, it displays overwrite confirmation prompts for each identically named value.
/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 ‘COPY’ command in Reg is used to copy (duplicate) keys within the registry. In Reg Copy, the target of the copy includes all values (and subkeys) within the key, so it is not possible to copy only specific values.

Samples

Sample

reg copy "HKLM\Software\My Company" "\\AkoPC\HKLM\Software\My Company" /s

Copies all subkeys and values within the ‘HKEY_LOCAL_MACHINE\Software\My Company’ key to ‘HKEY_LOCAL_MACHINE\Software\My Company’ on the computer ‘AkoPC’. (Since the /f option is not present, prompts will be displayed if identically named values exist.)

* When the target operation is a remote computer, only the root keys ‘HKEY_LOCAL_MACHINE’ and ‘HKEY_USERS’ can be used for that computer.