I want to restart Windows service using command prompt in [Icons]
section using Inno Setup. Please help me to solve the problem.
相关问题
- Why does a windows service, hosting an NserviceBus
- Starting an Application from Windows Service
- Inno Setup - Run InstallUtil from .Net 4.5 Locatio
- How do I run my C# service with elevated UAC privi
- Create a Service using C#
相关文章
- XCopy or MOVE do not work when a WCF Service runs
- Problem installing windows service
- In inno setup how to set the unins000.exe with pro
- Can't start Tomcat as Windows Service
- Running msiexec from a service (Local System accou
-
Cannot open
service on computer '. - Is it possible to create checkbox tree view in Inn
- How to add a region drop-down in Inno Setup?
This is my code, to start/stop a Windows service using
SC
command. If the service fails to start/stop, it will print a log info. You can try it by Inno Setup.You can start and stop and query services using the SC command. As for innosetup i'm not sure.
You could create a .bat-file with following content:
You can use
sc start [service]
to start a service andsc stop [service]
to stop it. With some servicesnet start [service]
is doing the same.But if you want to use it in the same batch, be aware that
sc stop
won't wait for the service to be stopped. In this case you have to usenet stop [service]
followed bynet start [service]
. This will be executed synchronously.To restart a running service:
However, if you don't know if the service is running in the first place and want to restart or start it, use this:
This works if the service is already running or not.
For reference, here is the documentation on conditional processing symbols.