Archive: Uninstaller location


Uninstaller location
Hi,

what can I do, if I want to place the "uninstall.exe" file in an other directory!?!

Some Installprograms (Setup Factory, InnoSetup, Installer Vise,...) place the "uninstall.exe" file in the $WINDIR, I also write this in my script, but the uninstall.exe didn't delete the files in the $INSTDIR.

Can someone help me? :cry:


Re: Uninstaller location
how did you specify the uninstallpath in the uninstall.exe?


Re: Uninstaller location

Originally posted by matze84
how did you specify the uninstallpath in the uninstall.exe?
The uninstallpath is "$WINDIR\Uninstall.exe" and the other files were placed in the installpath "$PROGRAMFILES\App".

Ex:
Section Install
SetOutPath "$INSTDIR"
SetOverwrite off
File "C:\MyApp\MyApp.exe"
File "C:\MyApp\MyApp.txt"
WriteUninstaller "$WINDIR\Uninstall.exe"
SectionEnd

Section Uninstall
Delete "$INSTDIR\MyApp.exe"
Delete "$INSTDIR\MyApp.txt"
Delete "$WINDIR\Uninstall.exe"
SectionEnd

The uninstaller only delete "$WINDIR\Uninstall.exe" and shortcuts but he didn't delete the files in the "$INSTDIR".

By default (I guess) Uninstaller sets $INSTDIR from it's current location. NSIS Help 4.2.2 - use ".onInit function to do a more advanced detection of install location". un.onInit on uninstall.

You can verify this using
MessageBox MB_OK "$INSTDIR"
in Uninstall section.

But I am not sure this is really need to do. :)
Read 4.6.2 Uninstall Section about Delete.


i have this problem at the moment too...

my uninstaller does not erase my shortcuts.. i don't know why ???


Attach your script to post - this helps in most cases :)


Thank you for this answers, I'm ready furiously. I searched in the NSIS User Manual, couln'd find something about this problem.

Can someone write me, where I can find the Helpsection about Uninstall configuration?

Is it maybe a bug in the Uninstaller?


I have had this problem too, its a "feature" of the uninstaller. When the uninstaller is not written to the $INSTDIR during installation, when you then run the uninstaller, it sets $INSTDIR to the directory where it is run from.

A fix for this is during installation to write the $INSTDIR to the registry somewhere, and in the un.onInit function, you need to read that registry key and set that to $INSTDIR

For Example...

Function un.onInit
;Show where the Uninstaller's original $INSTDIR is
MessageBox MB_OK "INSTDIR = $INSTDIR"
ReadRegStr $INSTDIR HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MyApp" "InstallLocation"
FunctionEnd


I have to do this with my installer since I put the uninstaller in the $INSTDIR\bin folder

Very thanks, you helped me very much!