码迷,mamicode.com
首页 > Windows程序 > 详细

Win 7 下 杀进程

时间:2014-10-04 04:55:16      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:vbs win7 杀进程

Call KillProcess("Skype.exe,xmptipwnd.1.0.0.79.exe,KKV.exe,1905Server.exe,xmp.exe,QvodWebService.exe")
 
Function KillProcess(strProcessToKill)
 
 processArr = split(strProcessToKill,",")
 
 Const strComputer = "."
 Dim objWMIService, colProcessList
 Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
 ‘processArr
 dim cond
 if ubound(processArr) = 0 then
 
 Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name =‘" & strProcessToKill & "‘")
 else
 for j = 0 to ubound(processArr)
  if j = 0 then
   cond = "Name = ‘" & processArr(j) & "‘ "
  else
   cond = cond & " or Name = ‘" & processArr(j) & "‘ "
  end if
  
  Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE " & cond )
 next
end if
 
 For Each objProcess in colProcessList
 objProcess.Terminate()
 Next
 
End Function



本文出自 “杭州丹尼” 博客,请务必保留此出处http://dannyhz.blog.51cto.com/2174974/1560554

Win 7 下 杀进程

标签:vbs win7 杀进程

原文地址:http://dannyhz.blog.51cto.com/2174974/1560554

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!