首页 > 代码库 > Win 7 下 杀进程

Win 7 下 杀进程

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 下 杀进程