我在论坛看到这段代码,说是可以杀掉除下列Process.ini配置文件里面的进程的P处理,我实际运行了下,根本无法实现,不知道是这么回事情,请教各位下,请指出哪错误了,并帮忙写出代码.谢谢!~
@echo off&Setlocal EnableDelayedExpansion
for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do (
for /f "delims=" %%b in (Process.ini) do (
set /a flag+=1
if /i not %%a=="%%b" set /a num+=1
)
if !flag! equ !num! taskkill /f /im %%a
set /a flag=num=0
)
echo the end...
Process.ini进程如下
alg.exe
csrss.exe
explorer.exe
lsass.exe
smss.exe
ctfmon.exe
services.exe
svchost.exe
winlogon.exe
System
System Idle Process
Wscript.exe
cmd.exe
还有,我是用P处理生成如上程序,保存为TASKKILL.BAT
能正常输出,但却被过滤掉了一个%,应该不影响使用吧??
我是这么写的...
@echo off
echo @echo off^&Setlocal EnableDelayedExpansion >>c:\taskkill.bat
echo for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do ( >>c:\taskkill.bat
echo for /f "delims=" %%b in (123.ini) do ( >>c:\taskkill.bat
echo set /a flag+=1 >>c:\taskkill.bat
echo if /i not %%a=="%%b" set /a num+=1 >>c:\taskkill.bat
echo ) >>c:\taskkill.bat
echo if !flag! equ !num! taskkill /f /im %%a >>c:\taskkill.bat
echo set /a flag=num=0 >>c:\taskkill.bat
echo ) >>c:\taskkill.bat
echo echo the end... >>c:\taskkill.bat
输出效果为:
@echo off&Setlocal EnableDelayedExpansion
for /f "tokens=1 delims=," %a in ('tasklist /nh /FO CSV') do (
for /f "delims=" %b in (123.ini) do (
set /a flag+=1
if /i not %a=="%b" set /a num+=1
)
if !flag! equ !num! taskkill /f /im %a
set /a flag=num=0
)
echo the end...
请各位帮忙完善下代码,并指出是什么原因导致无法正常运行的....
[ Last edited by luckboy45 on 2007-11-11 at 06:33 PM ]
@echo off&Setlocal EnableDelayedExpansion
for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do (
for /f "delims=" %%b in (Process.ini) do (
set /a flag+=1
if /i not %%a=="%%b" set /a num+=1
)
if !flag! equ !num! taskkill /f /im %%a
set /a flag=num=0
)
echo the end...
Process.ini进程如下
alg.exe
csrss.exe
explorer.exe
lsass.exe
smss.exe
ctfmon.exe
services.exe
svchost.exe
winlogon.exe
System
System Idle Process
Wscript.exe
cmd.exe
还有,我是用P处理生成如上程序,保存为TASKKILL.BAT
能正常输出,但却被过滤掉了一个%,应该不影响使用吧??
我是这么写的...
@echo off
echo @echo off^&Setlocal EnableDelayedExpansion >>c:\taskkill.bat
echo for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do ( >>c:\taskkill.bat
echo for /f "delims=" %%b in (123.ini) do ( >>c:\taskkill.bat
echo set /a flag+=1 >>c:\taskkill.bat
echo if /i not %%a=="%%b" set /a num+=1 >>c:\taskkill.bat
echo ) >>c:\taskkill.bat
echo if !flag! equ !num! taskkill /f /im %%a >>c:\taskkill.bat
echo set /a flag=num=0 >>c:\taskkill.bat
echo ) >>c:\taskkill.bat
echo echo the end... >>c:\taskkill.bat
输出效果为:
@echo off&Setlocal EnableDelayedExpansion
for /f "tokens=1 delims=," %a in ('tasklist /nh /FO CSV') do (
for /f "delims=" %b in (123.ini) do (
set /a flag+=1
if /i not %a=="%b" set /a num+=1
)
if !flag! equ !num! taskkill /f /im %a
set /a flag=num=0
)
echo the end...
请各位帮忙完善下代码,并指出是什么原因导致无法正常运行的....
[ Last edited by luckboy45 on 2007-11-11 at 06:33 PM ]
