nsis - NSIS 教程中的安装程序写入错误用户的桌面
问题描述
我正在尝试设置 NSIS 教程中的安装程序之一。安装程序只是将一个文本文件写入桌面,上面写着“Hello world!”。安装程序脚本如下所示:
# declare name of installer file
Outfile "hello world.exe"
# open section
Section
# create a popup box, with an OK button and some text
MessageBox MB_OK "Now We are Creating Hello_world.txt at Desktop!"
/* open an output file called "Hello_world.txt",
on the desktop in write mode. This file does not need to exist
before script is compiled and run */
FileOpen $0 "$DESKTOP\Hello_world.txt" w
# write the string "hello world!" to the output file
FileWrite $0 "hello world!"
# close the file
FileClose $0
# Show Success message.
MessageBox MB_OK "Hello_world.txt has been created successfully at Desktop!"
# end the section
SectionEnd
我遇到的问题是文件没有写入桌面。浏览了几分钟后,我能够在我的计算机上的 Admin 帐户而不是当前用户的桌面上找到该文件。我需要做什么才能将 NSIS 配置为使用当前登录的用户而不是管理员帐户?
解决方案
添加RequestExecutionLevel User
到您的脚本中,这将告诉 Windows 您不需要 UAC 提升。
当非管理员用户 UAC 提升新进程时,它将以 UAC 对话框中使用的管理员用户身份运行。
推荐阅读
- python-3.x - TKINTER:如何从列表框中删除项目/将项目添加到列表框中
- sql - 从 1 个表中选择条件在另一个表中的情况?
- javascript - 如何阻止我的 JavaScript 给出
- javascript - 当我尝试将电子商务应用程序上传到 Heroku 时出现 redux 记录器错误
- string - 无法更改 dtype pandas python
- c# - 复制后删除目录 XCOPY
- swift - 人们如何处理迭代 Swift 结构值类型属性?
- amazon-web-services - 使用具有指定存储类的 boto3 生成签名的 S3 url
- python - Python函数中多个输出的括号
- mysql - 当价值超过平均值时如何计算