03_NSIS產品安裝路徑_產生捷徑

03_NSIS產品安裝路徑_產生捷徑

03_NSIS產品安裝路徑_產生捷徑


#NSIS產品安裝路徑_產生捷徑

#Simply install a file

!include “WinVer.nsh”

; 應用程式名

!define PRODUCT_EXENAME “pro03.exe”

!define PRODUCT_INSTNAME “PythonSchool”

; 產品名稱

!define PRODUCT_NAME “pro03專案”

;安裝檔的檔名

OutFile “03.exe”

; 產品要安裝的路徑 $INSTDIR 的值

InstallDir “$DESKTOP”

Section “”

    #SetAutoClose true

    # define the output path for this file

    # The “$INSTDIR”‘s value is defind by InstallDir,

    # you can change like this: StrCpy $INSTDIR “C:\Program files\pythonschool”

    SetOutPath “$INSTDIR”#設定當前工作目錄

    File /r “*.txt”

    # define uninstaller name

    # use this sentence will made a uninstaller.exe file in “$INSTDIR”

    WriteUninstaller “$INSTDIR\uninst.exe”#產生卸載程式

SectionEnd

Section “桌面快捷方式” Sec_Desktop

#InitPluginsDir

#CreateShortCut “$PLUGINSDIR\${PRODUCT_INSTNAME}.lnk” “$INSTDIR\${PRODUCT_EXENAME}”

#Rename /REBOOTOK “$PLUGINSDIR\${PRODUCT_INSTNAME}.lnk” “$DESKTOP\${PRODUCT_INSTNAME}.lnk”

CreateShortCut “$DESKTOP\${PRODUCT_INSTNAME}.lnk” “$INSTDIR\${PRODUCT_EXENAME}”

SectionEnd

Section /o “快速啟動欄” Sec_Quick

    SetOutPath “$INSTDIR\”

    CreateShortCut “$QUICKLAUNCH\${PRODUCT_NAME}.lnk” “$INSTDIR\${PRODUCT_EXENAME}”

    ${If} ${AtLeastWin7}

      ExecShell taskbarpin “$QUICKLAUNCH\${PRODUCT_NAME}.lnk”

      Delete “$QUICKLAUNCH\${PRODUCT_NAME}.lnk”

    ${EndIf}

SectionEnd

Section “功能表列快捷方式” Sec_Menu

    SetOutPath “$SMPROGRAMS”

    CreateDirectory “$SMPROGRAMS\${PRODUCT_INSTNAME}”

    CreateShortCut “$SMPROGRAMS\${PRODUCT_INSTNAME}\${PRODUCT_INSTNAME}.lnk” “$INSTDIR\${PRODUCT_EXENAME}” # 主程序快捷方式

    #WriteIniStr “$INSTDIR\${PRODUCT_NAME}.url” “InternetShortcut” “URL” “${PRODUCT_WEB_SITE}” # 官方網址快捷方式

    #CreateShortCut “$SMPROGRAMS\${PRODUCT_INSTNAME}\Website.lnk” “$INSTDIR\${PRODUCT_NAME}.url” # 將官方網址快捷方式放到功能表列

    CreateShortCut “$SMPROGRAMS\${PRODUCT_INSTNAME}\Uninstall.lnk” “$INSTDIR\uninst.exe” # 卸載快捷方式

SectionEnd

Section “Uninstall”

    #SetAutoClose true

    # Always delete uninstaller.exe first

    # In %temp% the “Au_.exe” do the work really

    delete “$INSTDIR\uninst.exe”

    Delete “$DESKTOP\${PRODUCT_INSTNAME}.lnk”

    Delete “$INSTDIR\${PRODUCT_NAME}.url”

    ${If} ${AtLeastWin7}

    IfFileExists “$QUICKLAUNCH\User Pinned\TaskBar\${PRODUCT_NAME}.lnk” 0 +2

        Messagebox MB_OKCANCEL “是否刪除快速啟動欄” IDOK 0 IDCANCEL +2

    ExecShell taskbarunpin “$QUICKLAUNCH\User Pinned\TaskBar\${PRODUCT_NAME}.lnk”

    ${EndIf}

    ; 卸載開始功能表目錄

    RMDir /R “$SMPROGRAMS\${PRODUCT_INSTNAME}”

    ; Win7 下會在所有用戶(all)下進行創建

    SetShellVarContext all

    RMDir /R “$SMPROGRAMS\${PRODUCT_INSTNAME}”

    SetShellVarContext current

    RMDIR “$INSTDIR”

SectionEnd


 


發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *