简体   繁体   中英

nsis shortcuts not deleting after uninstall

I am using nsis to create windows installers for my application. I've added shortcuts for the app and the uninstall.exe in startup menu and I delete them as part of uninstall, but the shortcuts are not deleted during uninstallation. Snippet of the install and uninstall code is as below:

section "install"
    createDirectory "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\"
    createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME} Uninstall.lnk" "$INSTDIR\uninstall.exe"
    createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\logo.ico" 
sectionEnd

section "uninstall"
    delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME}.lnk"
    delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}\${APPNAME} Uninstall.lnk"
    rmDir /r "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}"    
sectionEnd

Can someone please help me with this.

Adding some details about which Windows version you are seeing this on etc. would help but I'm going to guess that this only happens on Vista and later . These versions of Windows have a compatibility shim that moves certain shortcuts to the all-users start menu.

To stop Windows from doing this you must mark the installer as UAC compatible, this can be done by adding the RequestExecutionLevel attribute to your script.

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