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 au
After creating your uninstaller create a product name entry in registry
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANY_NAME} ${PRODUCT_NAME}"
Section -Post
SetShellVarContext current
WriteUninstaller "${UNINST_PATH}\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
To see if the product is installed do
Function IsProductInstalled
ClearErrors
ReadRegStr $2 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName"
StrCmp $2 "" exit
In your uninstall you should be doing
Section Uninstall
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"