Inno Setup 不会安装到“Program Files” Win 7 上的受限用户
根据主题...我用 Inno Setup 制作了一个 Setup.exe ,它应该是 安装到“{pf}{#MyAppName}”。如果我是的话,它在 Win XP 和 Win 7 上都是如此 使用管理员权限登录,但如果我尝试以受限用户身份登录 Win 7,我会得到 此错误消息:
“安装程序无法创建目录 C:\Program Files\AppName”。
该怎么办?我不希望(或不需要)用户以管理员身份安装。
Per the subject... I made a Setup.exe with Inno Setup which is supposed to
install to "{pf}{#MyAppName}". It does so on Win XP and also Win 7 if I'm
logged in with admin rights, but if I try on Win 7 as a limited user, I get
this error message:
"Setup was unable to create the directory C:\Program Files\AppName".
What to do? I don't want (or need) the user to install as an admin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想安装到
%ProgramFiles%
,则需要以管理员身份安装。普通用户没有%ProgramFiles%
目录的写入权限。如果不需要安装到
%ProgramFiles%
,只需让用户选择目标目录,或者安装到{localappdata}
而不是{pf}.
{localappdata}
保证其所有者可写。它扩展为类似C:\Users\\AppData\Local
的内容。如果以管理员身份运行,您还可以安装到
{pf}
;如果以受限用户身份运行,则可以安装到{localappdata}
;使用 IsAdminLoggedOn 来决定。如果必须安装到
%ProgramFiles%
,您别无选择,只能以管理员身份运行。为了使其正常工作,请确保您的 .iss 文件未定义 PrivilegesRequired< /a> 选项,或者设置为
admin
。然后,当非特权用户运行安装程序时,将出现 UAC 提示,要求提供具有足够访问权限的凭据(除非 UAC 被禁用,在这种情况下,安装的唯一方法是运行方式)。If you want to install to
%ProgramFiles%
, you do need to install as an admin. Regular users don't have write access to%ProgramFiles%
directory.If installing to
%ProgramFiles%
is not a requirement, just let the user pick a destination directory, or install to{localappdata}
instead of{pf}
.{localappdata}
is guaranteed to be writable for it's owner. It expands to something likeC:\Users\<user name>\AppData\Local
.You can also install to
{pf}
if running as admin and to{localappdata}
if running as restricted user; use IsAdminLoggedOn to decide.If installing to
%ProgramFiles%
is a must, you have no choice but to run as admin.For this to work correctly, make sure that your .iss file either does not define PrivilegesRequired option, or it's set to
admin
. Then, when an unprivileged user runs the installer, a UAC prompt will appear asking for credentials with enough access rights (unless UAC is disabled, in which case the only way to install is Run As).