dizou
14th October 2011 19:55 UTC
Problem with ExecWait and regedit.exe
I have code like this:
RequestExecutionLevel admin
Section "Install"
#blah blah blah
ExecWait "regedit.exe $INSTDIR\Install.reg"
SectionEnd
I know this runs because I get a pop-up asking me if I would like to modify the registry. I click "Yes" when that appears and I get a confirmation saying that the registry has been successfully modified. However, when I actually open the registry to look, I do not see any changes.
When I do this process manually everything works. I double click on "Install.reg" and I get the same pop-up asking me if I would like to modify the registry. I click "Yes" and I get a confirmation saying that the registry has been modified. Then I open the registry and all the changes in the .reg file have been applied. Why is this not working in the NSIS file?
Yathosho
14th October 2011 22:55 UTC
wild guess: you need to put the path to the regfile in quotes
LoRd_MuldeR
15th October 2011 01:38 UTC
Yup, try something like:
ExecWait '"$SYSDIR\regedit.exe" "$INSTDIR\Install.reg"'
Afrow UK
15th October 2011 11:23 UTC
Ideally you should convert the .reg to WriteReg* instructions. There's a util for it on the Wiki IIRC.
Stu
dizou
17th October 2011 14:28 UTC
Originally posted by LoRd_MuldeR
Yup, try something like:
ExecWait '"$SYSDIR\regedit.exe" "$INSTDIR\Install.reg"'
I still get the same thing. I get the popup that asks me if I really want to modify the registry. I click "Yes", then I get the pop up that says the registry has been modified. Then when I look at the registry, none of the changes have been applied.
Originally posted by Afrow UK
Ideally you should convert the .reg to WriteReg* instructions. There's a util for it on the Wiki IIRC.
Stu
I am trying to delete a bunch of registry keys with this NSIS script.
I originally started with NSIS delete registry instructions and some of the keys were deleted and some of them were not. I also tried using VBS scripts to write to the registry and some of them were working and some of them were not.
I also tried using RunOnce to call a batch script that executes the .reg file. That will also only make some of my registry changes.
LoRd_MuldeR
17th October 2011 14:37 UTC
Are the keys you are trying to modify/delete in HKEY_LOCAL_MACHINE ???
If so, you will have to make sure that your installer gets elevated (on Vista+) by using RequestExecutionLevel admin and you have to check for Admin rights with the help of UserInfo in your .onInit function!
Also when using NSIS' regsitry functions, you can test the error flag to detect when an operation failed...
Moreover:
On Vista+ all access to 'HKEY_LOCAL_MACHINE\Software\...' will be re-directed 'HKEY_LOCAL_MACHINE\Software\WOW64Node\...' for 32-Bit applications. You have to take this into account when checking the result of your registry operations!