如何测试服务是否在命令行中运行

如何测试服务是否在命令行中运行

本文介绍了如何测试服务是否在命令行中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我希望能够查询服务是否从Windows批处理文件运行。我知道我可以使用:

but, this dumps out some text. What I really want is for it to set the errorlevel environment variable so that I can take action on that.

Do you know a simple way I can do this?

UPDATE
Thanks for the answers so far. I'm worried the solutions that parse the text may not work on non English operating systems. Does anybody know a way around this, or am I going to have to bite the bullet and write a console program to get this right.

解决方案
sc query "ServiceName" | find "RUNNING"

这篇关于如何测试服务是否在命令行中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 22:00