Windows中检查某一进程是否存在

Windows中有时需要进程名检查进程是否存在。
 
根据检查频率不同,批处理程序可以写成以下两种:

单次检查

@echo off 
@for /f %%i in ('tasklist /nh') do if "%%i"=="WinKawaks.exe" echo "exist" & goto end
@echo "not exist" 
:end

实时检查

@echo off 
:loop
tasklist /nh | find /i "WinKawaks.exe" > null
if ERRORLEVEL 1 (echo "not exist") else (echo "exist")
goto loop




posted @ 2012-02-08 21:50  __BSD__  阅读(2081)  评论(0编辑  收藏  举报