本人知道使用bat除了写入自己的pid好像有点难,其它没什么问题,对vbs了解不多,不知vbs可以做到吗
bat代码:- @echo off
- ::设置再次检测等待时间
- set xtime=10
- ::PID写出不会,没有想到绝妙的法子,试想过用先后tasklist对比分析,但觉得不科学准确性也不高... ...
- :recheck
- ::从pid.txt提取所要检查的pid
- if not exist pid.txt start a.exe&goto recheck
- for /f %%a in (pid.txt) do set pid=%%a
- :recheck2
- ::查看pid是否存在并作出判断后动作
- (for /f "skip=2 tokens=2 delims=," %%b in ('tasklist /fo csv /nh') do @echo=%%~b)|findstr /i "\<%pid%\>">nul
- if "%errorlevel%"=="0" (ping -n %xtime% 127.1>nul&goto recheck2) else start a.exe&goto recheck
复制代码 希望vbs大神能够解答 |