How to remove registry keys using REGEDIT

Via the Greek Guru, Peter Kammas:

In case you didn’t already know it, you can use .reg files to also REMOVE registry keys and/or values…

To do so, create a .reg file as follows:

Removing a registry key:

REGEDIT4

[-HKEY_LOCAL_MACHINE\SOFTWARE\DANADAWG]

(note the minus sign before the key name… this will remove the entire key, including subkeys and values, without prompting: so be careful)

Removing a registry value:

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\DANADAWG]
"Kennel Patch Install Date"=-

(note the minus sign after the equals sign on the value(s) you want to remove… this will only remove the value(s) specified)

Then it’s just a simple matter of executing the changes with a regedit /s <.reg file>

Note: Microsoft have documented this in How to add, modify, or delete registry subkeys and values by using a registration entries (.reg) file

Bookmark and Share