运行 进程(net.exe 或 sc.exe)在 Inno Setup 安装结束时具有管理员权限

Run process (net.exe or sc.exe) with Administrator privileges at the end of an installation in Inno Setup

在脚本的 [Run] 部分中,我想 运行 带有参数 start MyServicenet.exeFlags 是:

如果设置 运行 明确地作为管理员使用 "Run as administrator" 选项,服务将在用户点击 [ 后启动=46=]

如果只是双击安装程序(PrivilegesRequired 设置为 admin),则服务不会启动。

这也发生在 sc.exe

无论用户对 运行 设置做了什么,我必须做什么才能在最后启动服务?

使用runascurrentuser flag:

If this flag is specified, the spawned process will inherit Setup/Uninstall's user credentials (typically, full administrative privileges).

This is the default behavior when the postinstall flag is not used.