script to check if windows service is running and if it ain't to start that service. Windows 2000

StackOverflow https://stackoverflow.com/questions/13797672

سؤال

Unfortunately the SC command isn't available on W2000 yet, so I cannot use it.

I'm trying to check if a service is running or not on a W2000 server, and if it is not running the script should be able to start the service.

How to do this on Windows 2000?

هل كانت مفيدة؟

المحلول

net start | find "yourservice"
if %errorlevel%==1 net start "yourservice"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top