I have an NSIS Installer which calls the uninstaller to uninstall the older version.
ExecWait $INSTDIR\uninstall.exe /S _?=$INSTDIR
. The _?
switch is used to make the installer wait till uninstall is complete.
It indeed waits till uninstall is complete. But when i reboot my machine, uninstall.exe
is not present under $INSTDIR
.
The uninstaller section has commands to remove some sub-directories under $INSTDIR
with the /REBOOTOK
switch.
Ex : RmDir /r /REBOOTOK $INSTDIR\client
Will this cause uninstall.exe to be removed on machine reboot?
What is the position of this ExecWait
statement in regard of the section that deploy the uninstaller ?
It is possible that the uninstaller removes itself (or try to) and that there is a conflict between it and the "new uninstaller" related to way it removes itself : as an executable cannot be deleted during its execution, instead it marks itself for deletion during the next boot (if you use the /REBOOTOK
option). After that you are deploying the "new uninstaller" and if it has the same name it is removed on following boot.
You could try to play with the VIAddVersionKey
statement to define a version for the new installer that is different from the former. Then after installation, check if it is the new or the former unistaller.
Also look at the registry if you have a HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
multi_sz value that could contain the name of your uninstaller if it is marked for deletion during next boot.