2015-06-01 143 views
0

如何刪除我的installer文件夾中的intel_xdx文件夾。 intel_xdx文件夾裏面有文件&子目錄。此腳本不適用於我,我無法刪除intel_xdx文件夾。Nsis刪除文件夾和子文件夾 - 安裝程序內的目錄

我甚至在腳本中加入了RequestExecutionLevel admin

安裝程序適用於Windows 7 PC。

; Script generated by the HM NIS Edit Script Wizard. 

; HM NIS Edit Wizard helper defines 
!define PRODUCT_NAME "uiMagician" 
!define PRODUCT_VERSION "1.0.3" 
!define PRODUCT_PUBLISHER "Dinesh Guleria" 
!define PRODUCT_WEB_SITE "http://www.vscp.org/" 
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\uiMagician.exe" 
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 
!define PRODUCT_UNINST_ROOT_KEY "HKLM" 

; MUI 1.67 compatible ------ 
!include "MUI.nsh" 

; MUI Settings 
!define MUI_ABORTWARNING 
!define MUI_ICON "fatbee_v2.ico" 
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" 

; Welcome page 
!insertmacro MUI_PAGE_WELCOME 
; License page 
!insertmacro MUI_PAGE_LICENSE "uiMagicianLicence.txt" 
; Directory page 
!insertmacro MUI_PAGE_DIRECTORY 
; Instfiles page 
!insertmacro MUI_PAGE_INSTFILES 
; Finish page 
!define MUI_FINISHPAGE_RUN "$PROGRAMFILES\uiMagician\uiMagician.exe" 
!define MUI_FINISHPAGE_SHOWREADME "$PROGRAMFILES\uiMagician\Readme.txt" 
!insertmacro MUI_PAGE_FINISH 

; Uninstaller pages 
!insertmacro MUI_UNPAGE_INSTFILES 

; Language files 
!insertmacro MUI_LANGUAGE "English" 

; MUI end ------ 

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" 
OutFile "UiMagician_Setup.exe" 
RequestExecutionLevel admin 
InstallDir "$PROGRAMFILES\uiMagician" 
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" 
ShowInstDetails show 
ShowUnInstDetails show 


Section "MainSection" SEC01 
    SetOutPath "$PROGRAMFILES\uiMagician" 
    SetOverwrite ifnewer 
    File "uiMagicianLicence.txt" 
    File "uiMagician.exe" 
    CreateDirectory "$SMPROGRAMS\uiMagician" 
    CreateShortCut "$SMPROGRAMS\uiMagician\uiMagician.lnk" "$PROGRAMFILES\uiMagician\uiMagician.exe" 
    CreateShortCut "$DESKTOP\uiMagician.lnk" "$PROGRAMFILES\uiMagician\uiMagician.exe" 
    File "fatbee_v2.ico" 
    File "QtXml4.dll" 
    File "QtGui4.dll" 
    File "QtCore4.dll" 
    File "mingwm10.dll" 
    File "libgcc_s_dw2-1.dll" 
    File "HelpContent.xml" 
    File "Readme.txt" 
    File "HISTORY.txt" 
    File /a /r "intel_xdx\" 
SectionEnd 

Section -AdditionalIcons 
    SetOutPath $INSTDIR 
    WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" 
    CreateShortCut "$SMPROGRAMS\uiMagician\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" 
    CreateShortCut "$SMPROGRAMS\uiMagician\Uninstall.lnk" "$INSTDIR\uninst.exe" 
SectionEnd 

Section -Post 
    WriteUninstaller "$INSTDIR\uninst.exe" 
    WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$PROGRAMFILES\uiMagician\uiMagician.exe" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$PROGRAMFILES\uiMagician.exe" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" 
    WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" 
SectionEnd 


Function un.onUninstSuccess 
    HideWindow 
    MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." 
FunctionEnd 

Function un.onInit 
    MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 
    Abort 
FunctionEnd 

Section Uninstall 
    Delete "$INSTDIR\${PRODUCT_NAME}.url" 
    Delete "$INSTDIR\uninst.exe" 
    Delete "$PROGRAMFILES\uiMagician\Readme.txt" 
    Delete "$PROGRAMFILES\uiMagician\HelpContent.xml" 
    Delete "$PROGRAMFILES\uiMagician\libgcc_s_dw2-1.dll" 
    Delete "$PROGRAMFILES\uiMagician\mingwm10.dll" 
    Delete "$PROGRAMFILES\uiMagician\QtCore4.dll" 
    Delete "$PROGRAMFILES\uiMagician\QtGui4.dll" 
    Delete "$PROGRAMFILES\uiMagician\QtXml4.dll" 
    Delete "$PROGRAMFILES\uiMagician\sample.ico" 
    Delete "$PROGRAMFILES\uiMagician\uiMagician.exe" 
    Delete "$PROGRAMFILES\uiMagician\uiMagicianLicence.txt" 
    Delete "$PROGRAMFILES\uiMagician\fatbee_v2.ico" 
    Delete "$PROGRAMFILES\uiMagician\HISTORY.txt" 

    RMDir /r "$PROGRAMFILES\intel_xdx\" 

    Delete "$SMPROGRAMS\uiMagician\Uninstall.lnk" 
    Delete "$SMPROGRAMS\uiMagician\Website.lnk" 
    Delete "$DESKTOP\uiMagician.lnk" 
    Delete "$SMPROGRAMS\uiMagician\uiMagician.lnk" 

    RMDir "$SMPROGRAMS\uiMagician" 

    DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" 
    DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" 
    SetAutoClose true 
SectionEnd 

回答

0

您安裝intel_xdx到$PROGRAMFILES\uiMagician\intel_xdx但你想刪除$PROGRAMFILES\intel_xdx\

你爲什麼不直接刪除程序的文件夾:

RMDir /r "$SMPROGRAMS\uiMagician" 

甚至更​​好:

RMDir /r "$INSTDIR" 
+0

這個工作.. RMDIR/R 「$ INSTDIR」 – Katoch

相關問題