Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically merge .reg file into win32 registry

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...

like image 496
Scott Marlowe Avatar asked Aug 29 '08 19:08

Scott Marlowe


1 Answers

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"
like image 141
Matt Dillard Avatar answered Dec 26 '22 06:12

Matt Dillard