2

私が働いている会社が社内で使用しているアプリの 1 つの 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
4

1 に答える 1

5

アンインストーラで$instdirは、アンインストーラが存在するディレクトリです!

アンインストーラーを配置し$instdirて削除する$instdir\EST\ESTvncか、保持したい場合は$instdir\EST\ESTvnc削除し$instdirます...

于 2013-03-05T17:57:05.627 に答える