首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将所有用户目录设置为用NSIS创建的安装程序的输出目录

如何将所有用户目录设置为用NSIS创建的安装程序的输出目录
EN

Stack Overflow用户
提问于 2015-09-03 09:46:21
回答 1查看 383关注 0票数 1

我试图安装一个文件到所有用户文档目录(Windows 7)使用NSIS。

在我的代码中,我设置了"SetShellVarContext all“,但是文件仍然安装在当前用户目录下。

请帮帮忙

这是我的密码

代码语言:javascript
复制
    # 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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-03 11:32:58

SetShellVarContext不影响InstallDir属性,必须手动设置$InstDir:

代码语言:javascript
复制
Function .onInit
SetShellVarContext all
StrCpy $InstDir $Documents
FunctionEnd
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32372246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档