Scripting Registry Key Deletions

Cool tip on how to script registry key deletions ..

One of my colleagues (who wishes to remain
anonymous) gave me a great tip this morning – how to delete registry keys and values
using a .REG file.

To delete a value, set its contents to – in the .REG file, e.g.



Or to delete a key, add a – sign after the leading [ in the .REG file, e.g. [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\MyKey]

Apparently this works on all version of Windows from Windows 2000 onwards, although
I’ve only tried it with Windows XP Professional.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.