reg files: Deleting Registry Keys and Values
Posted by jpluimers on 2016/08/10
The registry key deletion example from Microsoft is slightly wrong, as they wrapped the code over three lines:
That confuses some people, so here is the correct example:
The registry value deletion misses the square brackets, so that example should be like this:
Deleting Registry Keys and Values
To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the
Testsubkey from the following registry key:
put a hyphen in front of the following registry key in the .reg file:
The following example has a .reg file that can perform this task.
To delete a registry value with a .reg file, put a hyphen (-) after the equals sign following the
DataItemNamein the .reg file. For example, to delete the
TestValueregistry value from the following registry key:
put a hyphen after the “TestValue”= in the .reg file. The following example has a .reg file that can perform this task.
To create the .reg file, use Regedit.exe to export the registry key that you want to delete, and then use Notepad to edit the .reg file and insert the hyphen.