日期:2014-05-17  浏览次数:20832 次

写个bat文件判断服务是否打开,若打开通过确认是否关闭实现关闭,若关闭通过确认是否打开实现打开。 - Windows专区 / 非技术区
写个bat文件判断服务是否打开,若打开通过确认是否关闭实现关闭,若关闭通过确认是否打开实现打开。
小弟分少,没多少分奉送!希望知道的告诉下。

------解决方案--------------------
服务名Security Center:
BatchFile code
wmic Service where DisplayName="Security Center" Get Started | find /i "true"
if errorlevel 1 (wmic Service where DisplayName="Security Center" Call StartService) else (
wmic Service where DisplayName="Security Center" Call StopService)