Registry - removing entries programmatically

Wed, 2007-07-18 11:22 by admin · Forum/category:

A minus sign inserted directly after the opening bracket in an otherwise normal .reg file removes that key. It works only for keys, not for values, but you can remove, then recreate a key. Example:

[-HKEY_LOCAL_MACHINE\Software\Adobe]

This entry in a .reg file will remove that entire key and all of its subkeys and values.

You can remove a value by entering a minus sign (without quotes) as the new value. Example:

[HKEY_LOCAL_MACHINE\Software\TestKey]
"TestValue"=-

This removes the value named "TestValue", but leaves the key "TestKey" in place.