怎么用批处理循环检测一个进程
比如每5秒循环检测1这个进程
或者是可以自定义时间检测
检测到1进程消失了 就执行一个命令A
然后结束批处理
检测运行的时候 cmd窗口隐藏起来
@echo off & title 监测进程 By 依梦琴瑶
set wt=5
set exe=1.exe
%1 start "" mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit
:Loop
tasklist | findstr /i "%exe%" >nul 2>nul || goto RunA
ping 127.0.0.1 -n "%wt%"
goto Loop
:RunA
::您的 A 命令书写区域
exit来自:求助得到的回答
set wt=5
set exe=1.exe
%1 start "" mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit
:Loop
tasklist | findstr /i "%exe%" >nul 2>nul || goto RunA
ping 127.0.0.1 -n "%wt%"
goto Loop
:RunA
::您的 A 命令书写区域
exit来自:求助得到的回答
温馨提示:答案为网友推荐,仅供参考