15

Is there an easy way in Windows to copy a registry branch to another part of the registry?

I need to copy everything in HKLM\SOFTWARE\Wow6432Node\Python to HKCU\SOFTWARE\Wow6432Node\Python to work around an issue with Python installers, but regedit doesn't appear to offer a way to copy a branch/folder. In this case, I'll probably solve the problem by copying each node by hand, since there isn't much to do, but I'm interested in a clean and easy solution for future reference.

4 Answers 4

13

You can use the reg command in Command Prompt. Note that administrator access is required to run this command. To open Command Prompt as Administrator:

  1. Open the Start Menu.
  2. In the search box, type cmd.
  3. Press Ctrl+Shift+Enter.

The syntax of the reg command is below.

REG COPY KeyName1 KeyName2 [/s] [/f]

  KeyName    [\\Machine\]FullKey
    Machine  Name of remote machine - omitting defaults to the current machine.
             Only HKLM and HKU are available on remote machines.
    FullKey  ROOTKEY\SubKey
    ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
    SubKey   The full name of a registry key under the selected ROOTKEY.

  /s         Copies all subkeys and values.

  /f         Forces the copy without prompt.

I've used this to copy keys between the 64-bit and 32-bit areas of the registry. For example:

reg copy HKLM\SOFTWARE\ODBC\ODBC.INI\dsname HKLM\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\dsname /s
7
  1. Use a better third party registry editor that allows cut/copy and paste of entire keys/branches.

  2. Export the HKLM\SOFTWARE\Wow6432Node\Python branch to a .REG file, use a text editor to replace all instances of HKLM with HKCU, save and import.

0
1

Ramesh Mekkara suggested this and it surely is the easiest way. Here are the steps to get started

  1. Right click on the top level key
  2. Export the key on your desktop / downloads folder, anywhere on the machine you like
  3. Right click the downloaded file and edit with Notepad
  4. Change the path mentioned within the square brackets []
  5. Save the file
  6. Double click the file, this will try to Run the file
  7. If asked for User Account Control, click Yes and you are done

Nothing messy just simple logic and you are set.

-3

I am not sure why no one suggested this. I too had the same requirement.

Export the key top level. Edit it manually to change the base location and import it.

1
  • Welcome to Super User! On this Q&A site we try to provide good answers to questions people post. Part of providing a good answer is by making sure someone else didn't already post the same solution. Another answer containing the same solution to the stated problem was already posted by Karan here.
    – Cas
    Oct 5, 2016 at 12:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .