bat判断服务是否启动


sc query|find "tomcat6" && echo yes || echo no
sc query|find "eventlog" && echo yes || echo no

sc query|find "eventlog" STATE=4 && echo yes || echo no

sc query|find "eventlog" start=all && echo yes || echo no
sc query "eventlog" start=all && echo yes || echo no
sc query "eventlog" STATE=4 && echo yes || echo no

--增加输入参数

set /p input_source=
sc query|find %input_source% STATE=4 && echo yes || echo no

posted @ 2015-05-10 11:35  小毛驴  阅读(2714)  评论(0编辑  收藏  举报