等待程序结束后, 自动启动程序的批处理

基本用于程序自身重启用, 很简单的代码

:start
(wmic process where creationclassname="win32_process" get executablepath) | (find /i "等待关闭的程序,包含路径")
if %errorlevel% equ 0 (goto start)
start "" "要启动的程序,包含路径"

2019-11-06 附加一个新的方案, 通过PID判断:

:start
tasklist /fi "pid eq 程序PID" | findstr /i "程序名(不含路径)" >nul &&goto start
::如果等待运行结束用下面的, 不等待用start "" "程序"启动
"要运行的程序(含路径)" "启动参数"
::执行完后删除自己
attrib -h -s -r -a %0
del %0
原文地址:https://www.cnblogs.com/lzl_17948876/p/7661570.html