Archive: Find and uninstall old version


Find and uninstall old version
I'm trying to find an old version of a program and uninstall that version before continuing with the installation. This is what I have so far


Function OldVer
IfFileExists $INSTDIR\uninst.exe 0 0
MessageBox MB_OK|MB_ICONINFORMATION "Setup will now uninstall an old version of Batch Terminate"
ExecWait "$INSTDIR\uninst.exe"
Return
FunctionEnd


It shows the dialog message everytime. It can find and run the uninstall program, however, it doesn't wait for the uninstall to complete and terminate.

Any ideas?
thank you in advance

http://www.google.com/search?q=nsis+uninstall+wait
http://nsis.sourceforge.net/When_I_u...he_uninstaller

3.2.2 Uninstaller Specific Options
_?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with ExecWait to wait for the uninstaller to finish. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.

Thank you for your reply, worked like a charm :)

However, I still have the problem of it triggering the Message Box regardless of whether or not the file is found.


Should be

IfFileExists $INSTDIR\uninst.exe 0 +3

Thank you very much both of you. Both problems now resolved