此方法可以用来监控Windows Service是否运行良好
1、创建批处理程序,判断服务是否启动,若未启动则启动之
@echo off Rem Look for the Print Spooler service in the list of started services net start | find /i "Print Spooler" Rem if not found, start it and a restart occurred. if "%errorlevel%"=="1" ( echo Service "Print Spooler" restarted at %time% on %date% by Script %0>>c:\ServiceRestart.Log net start "Print Spooler" )
2、创建任务计划,每隔1分钟执行以下第1步创建的bat