zoomzoom
20th February 2009 23:52 UTC
can't call java uninstaller from nsis uninstall
hi all,
so i'm trying to call:
MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216011FF}
the above works from the command line: it passes the java jre registry info to msiexec and it uninstalls jre.
PROBLEM: when i try to call it from within the 'uninstall' section, no luck! in the details window it shows that it calls the command 'Exec....' and it continues on; but the msi dialog window doesn't pop up nothing happens... i tried placing the command inside a .bat file, same thing, it appears that the .bat file is getting called, but no luck actually uninstalling jre (double clicking the .bat file works ok.)
i can make other exec calls from the 'Uninstall' section...
THANKS IN ADVANCE FOR YOUR HELP!!! LOVE NSIS!
;---CALL JAVA UNINSTALLER
DetailPrint "$SYSDIR\MsiExec.exe /X${UN_JAVA_REG}"
;"UNINSTALL JAVA: Call MSI pass java reg key";
;nsExec::ExecToStack '"MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216011FF}"'
;Exec '"MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216011FF}"'
;Exec '"aa.bat"'
pop $0
pop $1
MessageBox MB_OK "test1 $0 test2 $1"
Afrow UK
21st February 2009 00:00 UTC
You're using quotes wrongly, plus you should really use ExecWait:
ExecWait `MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216011FF}`
You had double quotes around everything when it should only be around the executable path (in case it contains spaces).
Stu
zoomzoom
21st February 2009 00:09 UTC
ah ha, works!
This was driving me bonkers all day!
I really appreciate the quick reply!
THANK YOU! THANK YOU!
LoRd_MuldeR
21st February 2009 00:22 UTC
In fact the correct way would be:
ExecWait '"$SYSDIR\MsiExec.exe" /X{26A24AE4-039D-4CA4-87B4-2F83216011FF}'
(Makes sure we run the correct MsiExec.exe from Windows System directory)
zoomzoom
21st February 2009 00:30 UTC
oh i see i originally had:
nsExec::ExecToStack '"$SYSDIR\MsiExec.exe /X${UN_JAVA_REG}"'
my double quote was at the end, should have been after .exe
Thanks!
LoRd_MuldeR
21st February 2009 00:38 UTC
Right. The outer quotes are only for NSIS. Only the inner quotes are passed to Windows.
Also the inner quotes must enclose the path to the executable file, as it might include whitespaces.
If you pass any parameters that do (or may) include whitespaces, you need to enclose them with quotes too.
Like that:
ExecWait '"$SYSDIR\MsiExec.exe" "/X{26A24AE4-039D-4CA4-87B4-2F83216011FF}"'
ExecWait '"$SYSDIR\MsiExec.exe" /i "C:\Downloads\VirtualBox\2.1.4\VirtualBox-2.1.4-42893-Win_amd64.msi"'