Eolsoft
Simple is better...

CmdRegedit Command Line Switches

Although not mentioned in the documentation, the Windows Registry Editor has a number of options for manipulating the Windows registry from the command line. Here are the syntax and usage examples.

Registry Exporting

To export all registry contens to the c:\all.reg file, use the /e switch as follows:

regedit /E c:\all.reg

To export a specific registry key to the file.reg file, use the /e switch as follows:

regedit /E file.reg <registry_key>

For example, the following command exports the list of startup programs from the "HKLM\Run" key:

regedit /E c:\hklm_run.reg "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run"

Registry Importing

Merge or import file.reg into a registry:

regedit file.reg

Registry Deleting

Deleting a Registry Key

Windows 11, 10, 8, 7

To delete a specific registry key from the registry, you can create the .reg file and specify the minus sign before the key name to delete, here is the example file contents of c:\del.reg:

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]

Now launch the Regedit using regedit c:\del.reg and the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System will be removed from the system registry.

Windows 95,98,ME

In the earlier Windows versions, Regedit has the /D switch, use it as follows:
regedit /D <registry_key>

For example, the following command will delete the entry of the CWS trojan:

regedit /D "HKEY_CLASSES_ROOT\CLSID\{834261E1-DD97-4177-853B-C907E5D5BD6E}"

Deleting a Registry Value

To delete a specific registry value, specify the minus sign instead of a value in the .reg file:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"CleanShutdown"=-

Other Switches

For silent execution of the Regedit program, use the /s parameter. If /s is specified, Regedit will suppress any informational dialog boxes and operate quietly, without asking for confirmation.

Windows 95,98,ME

There are also command line switches for specifying location of User.dat (/L) and user name (/R):

regedit /L:c:\windows\user.dat /e c:\test.reg