需求:windows系统上 根据进程名称查询进程,如果有进程就输出 up ,没有就输出 donw.
::Final interpretation is owned by chenglee ::@echo off<nul 3>nul @echo off&title Checking For SystemProcess, Thankyou... :2 color 0E wmic process get name | findStr /i "chat*" ::if not "%%a"=="%num%" goto en1 IF ERRORLEVEL 1 goto 1 IF ERRORLEVEL 0 goto 0 :0 echo.UP!! echo.Process exists, Exit after 5 seconds... ::进程存在,5秒后退出,如果不想退出的话,删掉下面的exit, 加上goto 2. choice /t 5 /d y /n >nul exit :1 echo.DOWN!! echo.Process does not Exist, 5 Seconds later, Continue to judge... ::进程不存在,5秒后继续判断. choice /t 5 /d y /n >nul goto 2 pause exit
完成!!