簡體   English   中英

如何將“所有用戶目錄”設置為使用NSIS創建的安裝程序的輸出目錄

[英]How to set the ALL USER Directory as an output directory for a installer created with NSIS

我正在嘗試使用NSIS將文件安裝到所有用戶文檔目錄(windows 7)。

在我的代碼中,我正在設置“ SetShellVarContext all”,但是仍然在當前用戶目錄中安裝了文件

請幫忙

這是我的代碼

    # define installer name
    OutFile "installer.exe"

    # set desktop as install directory
    InstallDir $DOCUMENTS

    # default section start
    Section

    # define output path
    SetShellVarContext all
    SetOutPath $INSTDIR

    # specify file to go in output path
    File test.txt

    # define uninstaller name
    WriteUninstaller $INSTDIR\uninstaller.exe


    #-------
    # default section end
    SectionEnd

    # create a section to define what the uninstaller does.
    # the section will always be named "Uninstall"
    Section "Uninstall"

    # Always delete uninstaller first
    Delete $INSTDIR\uninstaller.exe

    # now delete installed file
    Delete $INSTDIR\test.txt

    SectionEnd

SetShellVarContext不會影響InstallDir屬性,必須手動設置$ InstDir:

Function .onInit
SetShellVarContext all
StrCpy $InstDir $Documents
FunctionEnd

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM