标题:VBS代码可视化结束进程程序 出处:大漠荒颜 时间:Tue, 03 Aug 2010 01:13:36 +0000 作者:北纬36度 地址:http://www.736202.com/read.php/366.htm 内容: 无意间,在一论坛,看见这样的一段代码,觉得写的很有想法,拿来和大家分享下。 On Error Resume Next Set Shell = CreateObject("Wscript.Shell") Set App = CreateObject("Shell.Application") Do App.MinimizeAll Num = 0 Data = "" Set Add = CreateObject("Scripting.Dictionary") For Each Test in GetObject("Winmgmts:{ImpersonationLevel=Impersonate,(Backup)}!\\.\Root\Cimv2:Win32_Process").Instances_ If Db1 Test.Name Then Num = Num + 1 Select Case Num Case 1 Str = 5 Case 10 Str = 4 Case 100 Str = 3 End Select Data = Data + Chr(32) & Num & Chr(41) & String(Str,Chr(32)) & Test.Name & Chr(13) Add.Add Num , Test.Handle End If Db1 = Test.Name Next Do Enter = InputBox(Data,"Kill Process GUI (c) By Small flower"," Enter process num.",9800,100) If Enter "" Then If Enter < 0 Then Exit Do Else For I = Enter To Enter If Add(I) "" Then A = 0 B = 0 C = 0 For Each Test in GetObject("Winmgmts:{ImpersonationLevel=Impersonate,(Backup)}!\\.\Root\Cimv2").ExecQuery("Select * From Win32_Process Where Handle=" & Add(I)) A = A + 1 If Test.Terminate = 0 Then B = B + 1 Else C = C + 1 End If Next Shell.Popup "All:" & A & ",Success:" & B & ",Lose:" & C , 1 , "By Small flower" Exit Do Else Shell.Popup " Error,not process num :( " , 1 , "By Small flower" Exit Do End If Next End If Else Wscript.Quit End If Loop Set Add = Nothing Loop Generated by Bo-blog 2.1.1 Release