本帖最后由 batman 于 2013-1-31 20:36 编辑
无聊之作,各位看官也就请抱着平和心看看吧,不过里面还是有不少知识内容哦:- Dim OK
- On Error Resume Next
- OK = WScript.Arguments.Item(0)
- If Err.Number <> 0 Then Err.Clear
- If OK <> "" Then
- WScript.Echo "ProcessName PID WorkSize CommandLine"
- WScript.Echo String(79, "=")
- Dim objWMI, objItems, objItem, Name, ProcessID, WorkingSetSize, BWstr
- BWstr = String(20, " ")
- Set objWMI = GetObject("Winmgmts:")
- Set objItems = objWMI.ExecQuery("Select * From Win32_Process")
- For Each objItem In objItems
- If InStr(1, objItem.Name, ".exe", 1) Then
- Name = Left(objItem.Name & BWstr, 15)
- ProcessID = Right(BWstr & objItem.ProcessID, 6)
- WorkingSetSize = Right(BWstr & Int(objItem.WorkingSetSize / 1024), 8) & " k "
- WScript.Echo Name & ProcessID & WorkingSetSize & objItem.CommandLine
- End If
- Next
- Set objWMI = Nothing
- Do : WScript.Sleep 200 : Loop
- Else
- CreateObject("Wscript.Shell").Run "cmd /cstart cscript /nologo """ & WScript.ScriptFullName & """ OK", False, False
- End If
复制代码
|