Search code examples
nsisuninstallation

NSIS Identifying multiple uninstallers


I have multiple instances of a program and each has its own install directory with its own copy of the uninstaller. The installer has a field called "$instance" entered by the user which is recorded in the registry like this:

HKLM "SOFTWARE\@vendor.name@\@product.name@ @product.version@\installs\$instance"

which works fine. This key contains the root path of the install.

I would like to uninstall the instance of the program that corresponds to the uninstaller that is executed but the Uninstall section does not retain the variable "$instance" that the user entered at install time.

Any ideas?

Example:

Section Uninstall
    ; THIS does not display the instance name. :(
    MessageBox MB_OK "$instance"
SectionEnd

Solution

  • You can store custom data at the end of the uninstaller.exe without breaking the CRC check, or alternatively store it in a .ini in the same directory as the uninstaller (I do this all the time, just name the ini file "uninstaller.dat" or something like that so users don't mess with it)