结束系统进程

将一代码另存后缀: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

转载于:https://www.cnblogs.com/safezone/articles/1263665.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值