杀死指定进程名称的小VBS
以下是一小段杀死指定进程名字的小vbs,希望对大家有帮助。
Function KillProc(strProcName)
On Error Resume Next
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set arrProcesses = objWMIService.ExecQuery( "select * from win32_process where Name ='"&strProcName&"'" )
For Each proccess In arrProcesses
proccess.Terminate 0
Next
End Function
On Error Resume Next
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set arrProcesses = objWMIService.ExecQuery( "select * from win32_process where Name ='"&strProcName&"'" )
For Each proccess In arrProcesses
proccess.Terminate 0
Next
End Function