I have a command file running 24*7 , sometimes , this is stopped and requires
手动干预以重启命令文件。我可以使用其他命令文件(作业)文件监视来执行此操作。
" IF my .cmd is not running for <5mins , start again ? " ,
IF so How can this be achieved?
How can this be done using windows batch file.
Algorithm,
IF (Test.cmd is not running and sleep_time <(5*60) )
{ Start Test.cmd }
答案 0 :(得分:0)
你可以这样做:
@echo off
Set MyProcess=Notepad.exe
:test
tasklist | find /i "%MyProcess%">nul && Taskkill /F/IM "%MyProcess%" || start "%MyProcess%"
timeout 300 /nobreak
goto:test