I have an installer, a compiled NSIS script and it first checks if another version of my application is running on the system. If another instance exists, then it first triggers the silent uninstallation and then proceeds with installation of the new intance.
I use ExecWait to trigger the unistaller in the silent mode but my main installer process does not wait and goes ahead with the installation process.
How do I force the main installer to wait for the silent uninstallation to complete first?
nsi file by simply right-clicking on it in Explorer and selecting 'compile'. If you want to use MakeNSIS on the command line, the syntax of makensis is: makensis [ option | script.
1.1 About NSIS NSIS (Nullsoft Scriptable Install System) is a tool that allows programmers to create such installers for Windows. It is released under an open source license and is completely free for any use.
There is a special uninstaller parameter you need to use (The reason for this is that normally the uninstaller needs to be able to delete itself)
ExecWait '"$INSTDIR\uninstaller.exe" /S _?=$INSTDIR'
It is not just about "ExecWait". It is also about "_?", a special uninstaller instruction. Actually, during uninstall the uninstaller.exe is copied to a temp directory and then executed from there.
This step of copying and invoking a new uninstaller from temp directory might be fast and the call would come back immediately without actually waiting for the uninstaller to complete.
By using "_?" instruction you tell NSIS to run the uninstaller from the same place and not from the temp directory.
By using "ExecWait" in addition to the "_?" you tell NSIS to wait for the "uninstaller" process to complete and then return. This way you achieve what you need.
refer http://nsis.sourceforge.net/Docs/Chapter3.html#3.2.2 for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With