Windows 服务关闭自动重启

此方法可以用来监控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%"=="" (
echo Service "Print Spooler" restarted at %time% on %date% by Script %0>>c:\ServiceRestart.Log
net start "Print Spooler"
)
2、创建任务计划,每隔1分钟执行以下第1步创建的bat
上一篇:linux下开启、关闭、重启mysql服务


下一篇:题解 P5015 【标题统计】