标题: [技术讨论] VBS模拟TASKLIST [打印本页]
作者: batman 时间: 2013-1-31 20:14 标题: VBS模拟TASKLIST
本帖最后由 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
复制代码
作者: czjt1234 时间: 2013-2-2 08:14
没有横向滚动条,看起来比较乱
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |