I want to restart Windows service using command prompt in [Icons]
section using Inno Setup. Please help me to solve the problem.
You can use sc start [service]
to start a service and sc stop [service]
to stop it. With some services net 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 use net stop [service]
followed by net start [service]
. This will be executed synchronously.
You could create a .bat-file with following content:
net stop "my service name"
net start "my service name"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With