求一段点击后能帮你关闭你想要的几个进程的VBS代码()

来源:百度知道 编辑:UC知道 时间:2024/09/21 20:58:30
求一段点击后能帮你关闭你想要的几个进程的VBS代码()

可以用BAT: taskkill /im /f xxx.exe

'要结束的进程名,以|相隔:
pro="cmd|notepad|mspaint"
pro=Split(pro,"|")
For i=LBound(pro) To UBound(pro)
For Each p In GetObject("winmgmts:\\.\root\cimv2").execquery("select * from win32_process where name='"&pro(i)&".exe'",,48):p.terminate():Next
Next

Set WshShell = WScript.CreateObject("WScript.Shell")

Set wbemServices = Getobject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_Process")
For each wbemObject in wbemObjectSet
PID= wbemObject.ProcessID
Name = wbemObject.Name
Rem 比较Name与你要杀的进程名字,然后就可以得到PID
next

WshShell.Run "ntsd -c q -p " & PID,0
'具体杀死哪几个进程自己修改一下代码即可