要用批处理的话,这样子吧,不过我建议不要用批处理来监视...
要监视的服务为ALG。
- @echo off
- :start__
- for /f "usebackq skip=1" %%a in (
- `"wmic service where name='alg' get State"`
- ) do (
- if /i "%%a" == "Stopped" (
- wmic service where name="alg" call ChangeStartMode
- wmic service where name="alg" call startservice
- )
- )
- ping 127 -n 3
- goto :start__
复制代码
|