用批处理写一个 每30分钟可以检测某进程运行数量 当小于2个时杀掉该进程

如题所述

@echo Off & setlocal Enabledelayedexpansion
mode 65,15
:main
set times=
set exes=
set file_step=
set times=30
set "exes=QQ.exe"
:steps
set/a times-=1
for /l %%a in (60 -1 0) do (
cls& echo.& echo  还剩下 !times! 分 %%a 秒后检测进程, 请等待..
timeout /t 1 /nobreak>nul)
if !times!==0 (goto starts) else goto steps
:starts
del $ & >>$ (tasklist) & >>$1 (findstr "!exes!" "$") & move $1 $ & cls
for /f "delims=" %%a in ($) do set/a file_step+=1
if !file_step! leq 2 (
taskkill /f /im "!exes!"
) else goto main


将 QQ.exe 更改为您指定的进程名运行即可
中国批处理脚本联盟
WIN7 系统测试通过,如果您是 xp 用户请您反馈

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网