What's the best way to programmatically merge a .reg file into the registry? This is for unit testing; the .reg file is a test artifact which will be added then removed at the start and end of testing.
Or, if there's a better way to unit test against the registry...
It is possible to remove registry keys using a .reg file, although I'm not sure how well it's documented. Here's how:
REGEDIT4
[-HKEY_CURRENT_USER\Software\<otherpath>]
The -
in front of the key name tells Regedit
that you want to remove the key.
To run this silently, type:
regedit /s "myfile.reg"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With