我不知道如何开头 希望大家抛砖引玉 谢谢作者: pusofalse 时间: 2008-7-22 16:44 @echo off
for /f "delims=" %%a in (task.txt) do call set "proc=%%proc%%%%a "
for /f %%a in ('tasklist /nh^|findstr /i /v "%proc%"') do taskkill /im %%a /f
pause作者: recallshan 时间: 2008-7-22 16:58 谢谢 不过意思看的不是很懂 很否详细讲解作者: pusofalse 时间: 2008-7-22 17:07 @echo off
关闭回显
for /f "delims=" %%a in (task.txt) do call set "proc=%%proc%%%%a "
从task.txt中取值,并把%%a的值追加给变量proc
proc的值。。。proc=explorer.exe svchost.exe nod32kui.exe ...
for /f %%a in ('tasklist /nh^|findstr /i /v "%proc%"') do taskkill /im %%a /f
pause
在tasklist/nh命令结果中搜索不包含proc变量中explorer.exe或svchost.exe或。。。的行,并把找到的结果的第一列传给for,即进程名 然后taskkill作者: yiyuncao007 时间: 2008-7-22 17:50 那个把值追加给变量proc不是怎么懂,能不能解释一下呀作者: bat-zw 时间: 2008-7-22 18:03 二楼的代码能满足楼主的要求?作者: ZJHJ 时间: 2008-7-22 21:54 @echo off
::wangwei QQ251485609 by 08-01-01
::显示指定进程以外的进程
cd.>2w.txt
for /f %%i in (task.txt) do SET %%i=A
for /f %%i in ('tasklist /NH') do if /I not defined %%i echo %%i>>2w.txt
::获取指定进程以外进程的PID号
tasklist /NH>3w.txt
cd.>4w.txt
for /f %%i in (2w.txt) do findstr /i /r /c:"\<%%i\>" 3w.txt>>4w.txt
cd.>55.txt
for /f "tokens=2 delims= " %%i in (4w.txt) do @echo %%i>>55.txt
del task.txt
del 2w.txt
del 3w.txt
del 4w.txt
::按PID号自动终止进程
for /f %%i in (55.txt) do (
ntsd -c q -p "%%i"
)
del 55.txt作者: recallshan 时间: 2008-7-22 22:10
Quote:
Originally posted by zw19750516 at 2008-7-22 06:03 PM:
二楼的代码能满足楼主的要求?
恩 已经完成我想要的结果了作者: recallshan 时间: 2008-7-22 22:13
Quote:
Originally posted by pusofalse at 2008-7-22 05:07 PM:
@echo off
关闭回显
for /f "delims=" %%a in (task.txt) do call set "proc=%%proc%%%%a "
从task.txt中取值,并把%%a的值追加给变量proc
proc的值。。。proc=e ...