@echo off
echo %date% %time:~0,8% 启动守护程序
SET i = 0
:start
SET /a i = i + 1
echo %date% %time:~0,8% 第%i%次检查
%定时15s%
choice /t 15 /d y /n >nul
%寻找进程%
tasklist /fi "imagename eq 守护的进程.exe" | find "守护的进程.exe" > nul
%如果存在该进程%
if %errorlevel%==0 (
echo %date% %time:~0,8% 运行
) else ( %如果不存在,则自行启动%
echo %date% %time:~0,8% 重新启动
start 守护的进程.exe
choice /t 60 /d y /n >nul
)
goto start
文章评论