Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if a service is running

Status
Not open for further replies.

Callahan

Technical User
Nov 21, 2001
174
GB
Is there a way I can check if a service is already running using the command line? I want to use it in a batch file such as "If the service isn't running, uninstall it and reinstall it". I know I could just use a NET START but in this case it's not that simple.

Thanks for any suggestions/help.
 
I very much doubt you can uninstall and reinstall any service from a simple batch file; start, restart, stop, then yes. In any case, I'd recommend that was done by hand so you could catch any gotchas.
 
Have you looked into this?


We use it on Windows 2000 servers, and it does have the capability to query. Maybe use the resulting status will help in the batch file.

I still think miniorganmorgan's idea of actually watching the service uninstall/install is a good idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top