1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
On Error Resume Next Dim obj, pross, pid, killName pid = WScript.Arguments(1) killName = WScript.Arguments(0) Set obj = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set pross = obj.Execquery("Select * From Win32_Process") Wscript.echo "[PID]" & VbTab & "[ProName]" For Each proccess In pross If (WScript.Arguments.Count = 2) And (CStr(pid) = CStr(proccess.ProcessID)) Then proccess.Terminate 0 ElseIf Ucase(proccess.Name) = Ucase(killName) Then proccess.Terminate 0 Else WScript.echo proccess.ProcessID & VbTab & proccess.Name End If Next
|