【问题标题】:NSIS uninstaller doesn't delete files/foldersNSIS 卸载程序不会删除文件/文件夹
【发布时间】:2013-02-20 03:51:53
【问题描述】:

我正在为我工​​作的公司内部使用的其中一个应用程序编写 NSIS 安装程序,安装过程运行良好,创建了所有 REG 密钥没有问题,文件夹和服务也是如此,该应用程序使用。由于某种我无法理解的原因,卸载过程不起作用。

应用程序创建的服务被删除,注册表项也被删除,最简单的部分,文件本身,我无法通过卸载程序删除它们!

#Includes
!include "x64.nsh"
#Defines and Installer Properties
Outfile "ESTvnc Installer.exe"
Name ESTvnc 
Icon "${NSISDIR}\contrib\graphics\icons\VNCON.ico"
#Detect OS Version
Function .onInit
    StrCpy $instdir $PROGRAMFILES
    ${If} ${RunningX64}
        StrCpy $instdir $PROGRAMFILES32
    ${EndIf}
FunctionEnd

section
    SetShellVarContext all  
    CreateDirectory $instdir\EST\ESTvnc
    setOutPath $instdir\EST\ESTvnc
    File /r installfiles\*
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc\" \
                 "DisplayName" "ESTvnc"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc"\
                 "UninstallString" "$instdir\EST\ESTvnc\uninstaller.exe"
    writeUninstaller $instdir\EST\ESTvnc\uninstaller.exe
    ExecWait '"$instdir\EST\estvnc\estvnc.exe" -install'
sectionEnd

section "Uninstall"
    SetShellVarContext all  
    SimpleSC::StopService "ESTVNC" 1 30
    pop $0
    SimpleSC::StopService "ESTVNCSR" 1 30
    pop $0
    SimpleSC::RemoveService "ESTVNC"
    SimpleSC::RemoveService "ESTVNCSR"    
    RMDir /r "$instdir\EST\ESTvnc"  
    Delete $instdir\EST\ESTvnc\uninstaller.exe  
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ESTvnc"  
sectionEnd

【问题讨论】:

    标签: nsis delete-file


    【解决方案1】:

    在卸载程序中,$instdir是卸载程序所在的目录!

    将卸载程序放在$instdir 并删除$instdir\EST\ESTvnc,或者如果您想将其保留在$instdir\EST\ESTvnc,请删除$instdir...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-07
      • 2014-09-13
      • 2020-06-19
      • 2013-02-10
      • 1970-01-01
      • 2016-04-11
      • 2012-03-19
      • 1970-01-01
      相关资源
      最近更新 更多