繁体   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