NSIS 教程中的安装程序写入了错误的用户桌面
Installer from NSIS tutorial wrote to wrong user's desktop
我正在尝试设置 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 [=10=] "$DESKTOP\Hello_world.txt" w
# write the string "hello world!" to the output file
FileWrite [=10=] "hello world!"
# close the file
FileClose [=10=]
# Show Success message.
MessageBox MB_OK "Hello_world.txt has been created successfully at Desktop!"
# end the section
SectionEnd
我遇到的问题是文件没有写入桌面。在四处寻找几分钟后,我能够在我的计算机上而不是当前用户的管理员帐户的桌面上找到该文件。我需要做什么才能将 NSIS 配置为使用当前登录的用户而不是管理员帐户?
将 RequestExecutionLevel User
添加到您的脚本,这将告诉 Windows 您不需要 UAC 提升。
当非管理员用户 UAC 提升新进程时,它将 运行 作为 UAC 对话框中使用的管理员用户。
我正在尝试设置 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 [=10=] "$DESKTOP\Hello_world.txt" w
# write the string "hello world!" to the output file
FileWrite [=10=] "hello world!"
# close the file
FileClose [=10=]
# Show Success message.
MessageBox MB_OK "Hello_world.txt has been created successfully at Desktop!"
# end the section
SectionEnd
我遇到的问题是文件没有写入桌面。在四处寻找几分钟后,我能够在我的计算机上而不是当前用户的管理员帐户的桌面上找到该文件。我需要做什么才能将 NSIS 配置为使用当前登录的用户而不是管理员帐户?
将 RequestExecutionLevel User
添加到您的脚本,这将告诉 Windows 您不需要 UAC 提升。
当非管理员用户 UAC 提升新进程时,它将 运行 作为 UAC 对话框中使用的管理员用户。