Skip to content
⌘ NSIS Forum Archive

update/uninstall if already installed

7 posts

stopasking#

update/uninstall if already installed

Hello,

Sandboxie has an NSIS installation, and if it is already installed, it suggests to update or unintsall the program:


How do I do that in my installer?
Thanks!
MSG#
Nothing in NSIS is automatic, so you'll have to create this functionality yourself. Use nsDialogs to create a custom page containing a dirrequest element. Set an onChange function for it, use that to check whether the app already exists in the supplied path and change the page's contents accordingly.
sr164w#
regarding update installer

Hi,

I have NSIS generated installer.

Now i need to modify this as update intsaller.
what i am following is uninstall the old version and reinstall the new version.

uninstall :
uninstaller has few Delete RebookOK files even though those files got deleted by the uninstaller still it asks for the roboot ( i want overcome this unnecessary reboot.)
ExecWait '"$UnInstallString" /S _?=$INSTDIR' ; calling uninstaller

INSTDIR is different in each releases like CompanyName/ProductName/2.0 is the first installation and CompanyName/ProductName/2.1 is the second installation.

While installing new version INSTDIR will be different.

If I install 2.0.1.1 and When I call ExecWait '"$UnInstallString" /S _?=$INSTDIR' it delets the complete 2.0 directory and reinstall 2.0.1.1

but when I install 2.1 (already installed is 2.0....) and When I call ExecWait '"$UnInstallString" /S _?=$INSTDIR' it is not deleting the complete 2.0 directory instead it installs 2.1... in the separate folder CompanyName/ProductName/2.1.
But if i go to the installed directory and click on uninstall.exe of corresponding versions like 2.0 or 2.1 it uninstalls properly by deleting all its files and folders.

Help is highly appreciated 🙂

Please advice me on this !!!
Anders#
_?= tells the uninstaller what $instdir should be INSIDE the uninstaller, so normally you pass the same path as the location of uninstaller.exe. Example: ExecWait '"c:\myapp v1.2\uninstaller.exe" /S _?=c:\myapp v1.2'
sr164w#
my problem is uninstaller path and installation path are different.
how to tackle this situation? In this case ExecWait installation is not waiting for the uninstallation .

my case :
ExecWait '"c:\myapp\v1.2\uninstaller.exe" /S _?=c:\myapp\v1.3'