How can we insert multiple keys into a registry folder without using 3rd party tools?
Solution 1:
Using built in tools on Windows you have a few options.
- 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.
- 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
- Use a Group Policy Registry Preference item.
Use gpmc.msc
to configure a Group Policy Registry Preference and deploy it as needed.
Solution 2:
In addition to jscott's response, powershell can natively manage the registry.