以下是一小段杀死指定进程名字的小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
本文转自 fish_yy 51CTO博客,原文链接:http://blog.51cto.com/tester2test/158085,如需转载请自行联系原作者