Skip to content

Instantly share code, notes, and snippets.

@luqizheng
Last active December 10, 2015 08:28
Show Gist options
  • Select an option

  • Save luqizheng/cda3fcf2e4721d17dba2 to your computer and use it in GitHub Desktop.

Select an option

Save luqizheng/cda3fcf2e4721d17dba2 to your computer and use it in GitHub Desktop.
程序一旦关闭,会在5秒内自动重启
@echo on
:loop
echo Start checking
rem :请把下面的 check.bat* 更换你想要的windowtitle,不支持模糊查询,只能在后面*来区别
for /F "tokens=2 delims=," %%a in ('tasklist /fo csv /v /fi "windowTitle eq loopCheck.bat*"') do (
echo Infinity is exist, wait 5 sechond and re-check.
ping -n 5 127.1>nul
goto:loop
)
echo Infinity is not exist, and restart it
rem 这里是重启程序,我这里是随便写
notepad loopCheck.bat
goto :loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment