问题描述
按照Inno Setup KB:在启动"(或自动启动")组中创建快捷方式.
By following the Inno Setup KB: Create shortcuts in the Startup (or Autostart) group.
我有以下几行:
[Setup]
...
PrivilegesRequired=admin
[Icons]
Name: "{commonstartup}\app"; Filename: "app.exe"
但是在启动时,它显示访问被拒绝".看起来它不是以管理员身份运行.
However on startup, it says "access denied". Looks like it is not run as administrator.
我该怎么办?
推荐答案
如果我正确理解了您的问题,则您的应用程序需要以提升的特权运行.
If I understand your question correctly, your application requires to be run with elevated privileges.
您不能使用古老的启动"文件夹方法来运行具有更高特权的应用程序.
You cannot use the ancient "Startup" folder method to run applications with elevated privileges.
改为安排具有最高特权"的登录时"任务.
请参见如何在Windows下以用户登录名运行具有管理员权限的程序?
Instead schedule an "at logon" task with "highest privileges".
See How to run a program with administrator privileges on user login under Windows?
有关通过Inno Setup计划任务的信息,请参见如何使用Inno Setup添加计划的任务.
For scheduling a task from Inno Setup, see How to add a scheduled task with Inno Setup.
您将需要 schtasks
命令.
You will need the /RL highest
and /SC onlogon
switches of the schtasks
command.
[Run]
Filename: "schtasks"; \
Parameters: "/Create /F /RL highest /SC onlogon /TR ""app.exe"" /TN ""Run app as admin on logon"""; \
Flags: runhidden
这篇关于如何使用Inno Setup在具有管理员权限的情况下使程序在启动时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!