Programmatic way to tell when a service is stopped?

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Is there a programmatic way to tell when a windows service is stopped.

I would like to be able to issue a command from a programming language
and get back some sort of result that would let me know when a windows
service is down.

Thanks in advance for any information
 
Steve said:
Is there a programmatic way to tell when a windows service is stopped.

I would like to be able to issue a command from a programming language
and get back some sort of result that would let me know when a windows
service is down.

Thanks in advance for any information

Try this for the Windows Spooler service:

net start | find /i "Print Spooler" > nul

Now get your program to monitor the return code for
this command. It is 1 when the spooler is down.
 
Back
Top