How to Remove or Delete a Registry Key, Subkey and Values with .reg Registration Entries File

Posted: July 21, 2009/Under: Software/By: My Digital Life Editorial Team

Registry registration entries file, which ends in .reg file extension is an useful script that can automate import and merging of registry keys and value data inside the file to system registry, especially in unattended mode. Most Windows operating system has built-in handler that automatically handle and process a file with .reg extension by using RegEdit.exe, a GUI tool which also support command-line interface to search or edit the Windows registry.
While .reg registry registration entries file has been used to add new registry keys into system registry, it can also be used to remove or delete registry key or registry value data. This is useful when user wants to uninstall or undo registry hack, tweak, trick, or patch added via a .reg batch file where developer does not provide an uninstall script. In this case, user can modify the .reg file itself using the following guide to make an removal, deletion or uninstallation .reg registry registration entries file.

To remove and delete a registry key (entire registry tree branch and its sub-keys) with a .reg file, just add a hyphen (- or also known as minus) in front of the registry path (registry tree branch name) in the .reg file.

For example, a typical .reg file has the following syntax:

RegistryEditorVersion

[RegistryPath]
“DataItemName”=”DataType:DataValue”

Actual .reg file content example:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\My Digital Life]
“MDL”=dword:00000001

To delete the whole registry key (i.e. HKEY_CURRENT_USER\Software\My Digital Life) and its whole subkeys and value data, just add a hyphen in front. For example:

[-HKEY_CURRENT_USER\Software\My Digital Life]

To delete a specific or individual registry value with a .reg file, put a hyphen or minus (-) after the equal sign (=) following the DataItemName in the .reg file, replacing DataType:DataValue. For example, to delete the MDL registry value from above example, put a hyphen after the “MDL”= in the .reg file:

[HKEY_CURRENT_USER\Software\My Digital Life]
“MDL”=-

All editing of .reg file can be done with any text editor such as Notepad.