Inno Setup:使用"sc create"安装Windows服务 [英] Inno Setup: Installing Windows services using "sc create"
问题描述
我有两个二进制文件,必须为它们创建服务.我尝试使用如何使用Inno Setup安装Windows服务的"sc create"解决方案?
I have two binaries and have to create a service for them. I tried a solution using "sc create" from How to install a Windows service with Inno Setup?
但这对我不起作用.在安装结束时卡住了.我在做什么错了?
But it did not work for me. It's getting stuck at the end of the installation. What am I doing wrong?
这是我的代码:
Filename: {cmd}; Parameters: "sc create srvname start= auto DisplayName= mysrv binPath= {app}\mybinary.exe" ; Flags: runhidden
我尝试使用cmd
而不是{cmd}
-不变.
I tried using cmd
instead of {cmd}
- no change.
我没有在我提到的解决方案中尝试过Pascal代码.我将其保留为不得已的方法.
I did not try the Pascal code in the solution which I referred. I am keeping it as the last resort.
推荐答案
我使用了这段代码,并且我的两个服务都正在安装和卸载:
I used this code and both of my services are installing and uninstalling:
[run]
Filename: {sys}\sc.exe; Parameters: "create mysrv start= auto binPath= ""{app}\mysrv.exe""" ; Flags: runhidden
[UninstallRun]
Filename: {sys}\sc.exe; Parameters: "stop mysrv" ; Flags: runhidden
Filename: {sys}\sc.exe; Parameters: "delete mysrv" ; Flags: runhidden
这解决了我的问题,所以在这种情况下为什么要使用Pascal ??
This solved my problem, so why should I use Pascal in this case.?
这篇关于Inno Setup:使用"sc create"安装Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!