关闭除csrss.exe、explorer.exe、lsass.exe、smss.exe、services.exe、svchost.exe、winlogon.exe、system、System Idle Process的所有进程
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process " )
For Each objProcess In colProcess
Select Case objProcess.caption
Case "csrss.exe"
Case "explorer.exe"
Case "lsass.exe"
Case "smss.exe"
Case "services.exe"
Case "svchost.exe"
Case "winlogon.exe"
Case "system System Idle Process"
Case Else
objProcess.Terminate()
End Select
Next 以上是VBS脚本,下面是命令脚本需建一个
Process.ini文件,并将不需要关闭的进程放进去@echo off&Setlocal EnableDelayedExpansion
rem Code by lxmxn # bbs.cn-dos.net
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...
posted on 2007-10-16 14:50
疾风随影 阅读(436)
评论(0) 编辑 收藏 引用 所属分类:
Script & Batch column