The Windows Doc command loop checks whether the process exists, restarts if it does not exist, etc.

To use the command, create a new text directly in the format of .bat. Then paste the following code into the text and double-click to run it.

PS: When using, remember to delete the text content of the brackets and brackets

@echo off & title 监测进程By Garcia
:start
cls
tasklist|find /i "chrome.exe" (进程的exe文件名)
if %errorlevel%==0 goto runff
if %errorlevel%==1 echo 没有找到该进程正在准备重启中...&goto open
:runff
ping 127.0.0.1 -n 5 (5秒执行一次)
echo 进程正常运行中!&goto start

:open
start /d "C:\Program Files\Google\Chrome\Application\" chrome.exe  (需要运行的exe路径)
goto start

Guess you like

Origin blog.csdn.net/Qensq/article/details/120344068