在Inno Setup中安装结束时,以管理员权限运行进程(net.exe或sc.exe) [英] Run process (net.exe or sc.exe) with Administrator privileges at the end of an installation in Inno Setup

查看:133
本文介绍了在Inno Setup中安装结束时,以管理员权限运行进程(net.exe或sc.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在脚本的 [Run] 部分中,我要使用参数 start MyService 运行 net.exe . Flags 是:

In the [Run] section of my script I want to run the net.exe with the parameter start MyService. The Flags are:

  • waituntilterminated
  • runhidden
  • 后安装

如果使用以管理员身份运行" 选项以管理员身份明确运行安装程序,则在用户单击完成" 后,该服务即会启动.

If the setup is run explicitly as administrator with the "Run as administrator" option, the service gets started after the user hits "Finish".

如果仅双击设置( PrivilegesRequired 设置为 admin ),则该服务无法启动.

If the setup is just double clicked (PrivilegesRequired is set to admin) the service doesn't get started.

sc.exe

我该怎么办,以便无论用户为运行安装程序做了什么,该服务都能在最后启动?

What do I have to do, so that the service gets started at the end, no matter what the user did to run the setup?

推荐答案

使用 runascurrentuser 标志:

如果指定了此标志,则生成的进程将继承安装程序/卸载程序的用户凭据(通常是完全管理特权).

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

这是不使用 postinstall 标志时的默认行为.

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

这篇关于在Inno Setup中安装结束时,以管理员权限运行进程(net.exe或sc.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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