且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查进程是否正在通过批处理脚本运行

更新时间:2023-12-05 11:45:22

我想到的另一种可能性是,使用 grep ,is:

Another possibility I came up with, inspired by using grep, is:

tasklist /FI "IMAGENAME eq myapp.exe" 2>NUL | find /I /N "myapp.exe">NUL
if "%ERRORLEVEL%"=="0" echo Programm is running

它不需要保存一个额外的文件,所以我喜欢这种方法。

It doesn't need to save an extra file, so I prefer this method.