Hi there, thanks for the example. Excellent stuff!
total noob, with several services that I'd like to manually manage (start when they're needed, as they struggle to start by themselves, failing to honour the ONDEMAND setting).
I have Sandboxie, to run apps in a virtual container in virtual memory.
I don't need it running all the time, but if it's only on manual and I use the context menu option to run an application sandboxed, it fails. Toggling the service status would be a good (interim?!) solution...
So I've followed some examples, but not sure if there are better ways to do things.. also not even working yet. Here's the code (I've modified and combined working code that uses same commands etc, alas no avail.
RunAsAdmin() ; installed superuseful script that runs scripts as admin. a necessity I think for handling process/service requests?
Process, Exist, "C:\Program Files\Sandboxie\SbieSvc.exe" ; check to see if program is running
If (ErrorLevel = 0) ; If program is not running -> Run
;RunWait,sc start %svc%;Start svc
RunWait, sc start sbiesvc
RunWait,sc stop %svc%; Stop service.
If (ErrorLevel = 0) ;If svc stopped