你如何在 NSIS 中设置目录权限? [英] How do you set directory permissions in NSIS?

查看:65
本文介绍了你如何在 NSIS 中设置目录权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用需要管理员安装的 Nullsoft 安装系统来构建 Windows 安装程序.安装程序创建一个日志"目录.由于普通用户可以运行此应用程序,因此该目录需要可由普通用户写入.我如何指定所有用户都应该拥有使用 NSIS 脚本语言对该目录进行写访问的权限?

I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to have write access to that directory in the NSIS script language?

我承认这听起来有点像坏主意,但该应用程序只是一个内部应用程序,只有少数人在专用网络上使用.我只需要保存日志文件,这样我就可以看到如果发生不好的事情,应用程序为什么会损坏.用户不能成为管理员.

I admit that this sounds a like a sort of bad idea, but the application is just an internal app used by only a few people on a private network. I just need the log files saved so that I can see why the app is broken if something bad happens. The users can't be made administrator.

推荐答案

使用 AccessControl 插件然后将其添加到脚本中,其中logs"目录位于安装目录中.

Use the AccessControl plugin and then add this to the script, where the "logs" directory is in the install directory.

AccessControl::GrantOnFile "$INSTDIRlogs" "(BU)" "FullAccess"

这为所有用户提供了对该文件夹的完全访问权限.

That gives full access to the folder for all users.

这篇关于你如何在 NSIS 中设置目录权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆