结束系统进程

将一代码另存后缀:vbs

'
'
注意:1.编辑本文件时请不要用自动换行
'
      
'
dim constComList,ComCell,constComLike,constSystemComList,MsgKill
dim ComListComLike,SystemComList

'1.系统进程列表,为了查找进程提高速度,此列表中的进程不会杀掉,也不会去和COM的列表去匹配.

constSystemComList
="system;smss.exe;csrss.exe;winlogon.exe;services.exe;lsass.exe;svchost.exe;"&_
"spoolsv.exe;explorer.exe;ctfmon.exe;inetinfo.exe;taskmgr.exe;conime.exe;"

'end 1

'2.这里是COM的列表,在Conductor的RegCom.INI文件中有包括客户端和服务器端的所有元件.也就是要杀掉的进程
'
注意最后一个分号一定要加

constComList
="VALIDATORC.DLL;F2WINDOWC.DLL;CounterC.Dll;QueueManagerC.exe;ReportViewerC.dll;"&_
"CodeWinC.dll;LoadBOMC.dll;LeaderWorkCenter.exe;DSCPagerC.exe;TextViewerC.dll;AttachC.dll;"&_
"DMSC.dll;TransManagerC.dll;DSCFAX.exe;GridViewerC.dll;"&_
"ReportCounterS.exe;F2WindowS.exe;ReportViewerS.exe;TransManager.exe;CounterS.exe;"&_
"ValidatorS.exe;VoucherS.exe;HtmlGeneratorS.exe;CodeWinS.exe;LoadBOMS.exe;CopIS01S.exe;"&_
"DsQueryS.exe;DSCPagerS.exe;AttachS.exe;DMSS.exe;LeaderWorkCenterS.exe;TextViewerS.exe;Rgrr01S.exe;"&_
"EFCoordinatorOfERP.dll;DSCFAXSVR.exe;GridViewerS.exe;MainMenu.exe;VarManagers.exe;ntsd.exe"

'end 2

'3.这里是模糊查找的COM列表,例如Transmodi,counter,进程中包括这些字母的都会被杀掉,请小心使用!

constComLike
="Transmodi;counter;"

'end 3

'4.这里表示是否显示杀掉的进程讯息对话框
showMsg=true
'end 4

MsgKill
= ""
set ws=wscript.createobject("wscript.shell")
for each ps in getobject _  
  (
"winmgmts:\\.\root\cimv2:win32_process").instances_  
  ComList 
= constComList
  ComLike 
= constComLike
  SystemComList
=constSystemComList
  
  
if InStr(1,LCase(SystemComList),LCase(ps.name))<=0 then 
    

  
do while (ComList<>"")
    ComCell 
= Left(ComList, InStr(1, ComList, ";")-1
    ComList 
= Right(ComList, Len(ComList) - InStr(1, ComList, ";"))
    ComCell 
= Left(ComCell, 15)
    
if LCase(ps.name)=LCase(ComCell) then 
      ws.run 
"ntsd -c q -p "+ps.handle,vbhide
      
if MsgKill="" then
        MsgKill 
= ps.name
      
else
        MsgKill 
= MsgKill+";"+ps.name
      
end if
      
exit do
    
end if    
  
loop
 
  
do while (ComLike<>"")
    ComCell 
= Left(ComLike, InStr(1, ComLike, ";")-1
    ComLike 
= Right(ComLike, Len(ComLike) - InStr(1, ComLike, ";"))
    ComCell 
= Left(ComCell, 15)
    
if InStr(1,LCase(ps.name),LCase(ComCell))>0 then 
      ws.run 
"ntsd -c q -p "+ps.handle,vbhide
      
if MsgKill="" then
        MsgKill 
= ps.name
      
else
        MsgKill 
= MsgKill+";"+ps.name
      
end if

      
exit do
    
end if    
  
loop
  
end if
:
next
if (MsgKill <> ""and showMsg then
msgbox MsgKill
end if

posted @ 2008-08-08 13:02  威尼斯的夏天  阅读(549)  评论(0编辑  收藏  举报