简体   繁体   中英

How to uninstall previous version silently using NSIS script?

I need to uninstall previous version if installed already. I have a NSIS script. Here is what I have tried:-

Function UninstallPreviousVersion
    ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" 
    StrCmp $R0 "" done remove
    remove:
           DetailPrint "Removing previous installation."
           ExecWait '"$INSTDIR\uninst.exe" /S _?=$INSTDIR'
    done:
FunctionEnd

But When I run it instead of uninstalling old and install new version. it creates a new folder 'bin' under installation folder.

Any help please?

You might want to read the uninstall directory from the registry in case the old install location is not the same as $instdir but this is not your real problem. Your code does look correct so I suggest you do some "MessageBox debugging" in your uninstaller code...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM