6

To insert multiple keys into a registry folder (e.g. Computer\HKEY_CLASSES_ROOT\....\....), I basically have to manually right click → New → Key for each key.

enter image description here

This can get annoying and redundant, especially at times when I need to insert more than 10 keys.

Is there a way to insert multiple keys into a registry folder using the default GUI?

Is there a cmd command to do that?

Pacerier
  • 511
  • 15
  • 35

2 Answers2

13

Using built in tools on Windows you have a few options.

  1. Use the regedit GUI.

Microsoft regedit provides import and export [export visible in your screenshot] options. When you export a key, it will appear in a .REG file. This is an example.

example.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Example]
[HKEY_CURRENT_USER\SOFTWARE\Example\keyA]
"value0"=dword:00000000
"value1"="data"

To import open regedit, use the menu and navigate File -> Import, then select the .REG file.

  1. Use the reg command line utility.

The reg utility also provides import and export options. To perform the same steps as above, you would do something like.

:: Export
REG EXPORT HKCU\SOFTWARE\example\ example.reg

:: Import
REG IMPORT example.reg

You can also write keys/values/data ad-hoc with reg.

REG ADD "HKCU\SOFTWARE\example\keyA" /v "value0" /t REG_DWORD /d "0" /f
REG ADD "HKCU\SOFTWARE\example\keyA" /v "value1" /t REG_SZ /d "data" /f
  1. Use a Group Policy Registry Preference item.

Use gpmc.msc to configure a Group Policy Registry Preference and deploy it as needed.

gpp registry item

jscott
  • 24,204
  • 8
  • 77
  • 99
4

In addition to jscott's response, powershell can natively manage the registry.

Andy
  • 1,101
  • 1
  • 7
  • 10
  • Not avail on server 2003 and many other systems. – Pacerier Apr 11 '15 at 10:19
  • 1
    Not *natively* on server 2003 true, but after July this year it will be on every supported version of windows. – Andy Apr 11 '15 at 11:17
  • You'll need to clarify what you mean by that. Do you mean **every** from the very first version of Windows? – Pacerier Apr 11 '15 at 14:18
  • 1
    @Pacerier [Support for Windows Server 2003 ends July 14, 2015](http://www.microsoft.com/en-us/server-cloud/products/windows-server-2003/). After which all _supported_ versions of Windows will also have PowerShell. – jscott Apr 11 '15 at 14:21
  • @jscott, Ah, [semantics](http://superuser.com/q/758307/78897)....... – Pacerier Apr 11 '15 at 14:25
  • Powershell 2.0 can also be installed on Windows 2003 and XP. – briantist Apr 11 '15 at 15:33
  • Seriously? A powershell reference w/ no code? -1, _code or it didn't happen._ – MDMoore313 Apr 13 '15 at 03:39
  • @BigHomie - Thanks, i will endeavour to copy the contents of a linked website into my answer rather than merely link to it next time. – Andy Apr 13 '15 at 08:59
  • Andy, even if this *is* a link to technet, a link only answer is bad for several reasons here. – MDMoore313 Apr 13 '15 at 12:09