Search notes:

regedit.exe

regedit.exe is a GUI based registry editor. A console based registry editor is reg.exe
Surprisingly, at least to me, regedit.exe is located under %SystemRoot% rather than under %SystemRoot%\System32.
regedit.exe can be used in cmd.exe to import data into the registry or to export portions of the registry.

Command line operations

Opening multiple copies of regedit

When given the /m option, regedit will open another window (and not try to replace another running instance of regedit):
C:\> regedit /m

Exporting a subtree

Export the contents of HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies to the file x:\path\to\export_file.reg:
regedit /e x:\path\to\export_file.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies"
Note: if the file is speciefied without absolute path, it will be exported into the directory that was also used in the last export. So, you might want to use the environment variable %CD% to make sure that the exported file goes into the current directory:
regedit /e %CD%\export_file.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows"

Exporting HKLM and HKCU

Without specifying a registry key in an export, it will default to exporting both HKEY_LOCALE_MACHINE and HKEY_CURRENT_USER:
regedit /e %CD%\export_file.reg 

Importing a subtree

The /s causes the import to be silent.
regedit /s import_file.reg

Format of import file

An import file must start with Windows Registry Editor Version 5.00.
Windows Registry Editor Version 5.00 

; Comments start with a semicolon

[HKEY_CURRENT_USER\path\to\a\key]
"A String Value"="foo bar"
"A dword values"=dword:00000001

[HKEY_CURRENT_USER\another\path\to\another\key]
"Another String Vaue"="baz"

; The minus sign causes deletions
[-HKEY_CURRENT_USER\path\to\be\deleted]

[HKEY_CURRENT_USER\another\path\again]
"Delete This Value only"=-


Showing an (independent) registry hive

The menu File -> Load Hive allows to show an «independent» registry hive. This menu is active when one of the «top level» keys (such as HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER) is selected.
This operation only shows the data of the hive, it does not import it.
When such a hive is loaded, its data can be modified normally.
The menu File -> Unload Hive will disassociate the loaded hive from regedit.
See also reg load and the WinAPI function RegLoadAppKey.

Favorites

The menu Favorites allows to add and remove registry paths so that they can quickly be navigated to. Added paths are also shown in this menu.
The favorite paths are stored in the registry under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites

Opening the registry at a given key

Unfortunately, regedit.exe does not have a command line option to specify a registry key that should be displayed when regedit.exe starts.
However, regedit.exe stores the last visited key in the registry (where else) under the value LastKey in the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit.
So, in order to open the registry at a specific key, one needs to first change the value of LastKey and then start regedit.exe.
This idea is implemented in the batch file regat.bat and the PowerShell version regat.ps1. regat stands for registry at.
The same idea is formulated with the Perl module Win32::TieRegistry which can be used to manipulate the registry with Perl: op-reg-at.pl.
Another tool that does the same thing is regjump.exe (by Sysinternals).

Exporting a sub-tree

Choosing *.txt format when exporting a sub tree causes the produced file to reveal the time stamps of the last write time.

See also

regedit.exe does not consider hyphens when sorting items.
reg.exe
regini.exe

Index