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

<p>Or, if there's a better way to unit test against the registry...</p>

I looked into it by checking out my file associations.
It seems that a .reg file is just called as the first parameter to the
```
regedit.exe
```
executable on Windows.
So you can just say
```
regedit.exe "mytest.reg"
```
. What I'm not sure of is how to get rid of the dialog box that pops up that asks for your confirmation.