Bat——通过批处理检测应用程序状态

前言

通过bat脚本检测应用程序非运行状态的程序

内容

<应用程序> 替换成自己要检测的程序名称

::WeComStatus
::By WY 2021-12-15
@echo off
:start

:: 检测状态为非RUNNING状态的<应用程序>
:: for /? 查看帮助
for /f "skip=3 tokens=2 " %%i in ('tasklist /V /FI "STATUS ne RUNNING" /FI "imageNAME eq <应用程序>"') do (
 ::日志输出文件主要看bat启动位置
  echo %Date% %time% %%i  开始清除无响应的<应用程序>进程 >> "<应用程序>Status.txt"
  taskkill /F /PID %%i /T >> "<应用程序>ComStatus.txt"
)

:: choice /? 查看帮助
choice /t 10 /d y /n > null

:: goto /? 查看帮助
goto start
学无止境,谦卑而行.
原文地址:https://www.cnblogs.com/wangyang0210/p/15692559.html