I'm using NSIS to create an installer for a program, what is the best way to detect if this program is already installed? Also, since I'm running the installer from the autorun.inf, can I immediately quit the installer if it locates an installed copy? Is there a better way to do this?
How about this. I had this in an old NSIS script laying around.
; Check to see if already installed
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<YOUR-APP-NAME>" "UninstallString"
IfFileExists $R0 +1 NotInstalled
messagebox::show MB_DEFBUTTON4|MB_TOPMOST "<YOUR-APP-NAME>" \
"0,103" \
"<YOUR-APP-NAME> is already installed." \
"Launch Uninstall" "Cancel"
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Quit:
Quit
NotInstalled: