[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

求教VBS提示增多或减少正在运行的进程怎样写?

用VBS写,也可以用BAT和VBS结合起来写,用于实时监测进程变化的.(只需显示刚增加或减少的进程则可)
不是列出整个进程表(进程管理器)

谢谢!

[ 本帖最后由 wgmlzj 于 2008-10-29 12:19 编辑 ]

增加或减少以哪个数值为基准?
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

  1. If WScript.Arguments.Count = 0 Then
  2. RunExe "cmd /k start /b " _
  3. & "cscript //nologo " & """" & WScript.ScriptFullName & """" & " MonitorCreation & " _
  4. & "cscript //nologo " & """" & WScript.ScriptFullName & """" & " MonitorDeletion"
  5. WScript.Quit
  6. End If
  7. Execute WScript.Arguments(0)
  8. Sub RunExe(strPath)
  9. Dim objWSH
  10. Set objWSH = CreateObject("WScript.Shell")
  11. objWSH.Run strPath
  12. Set objWSH = Nothing
  13. End Sub
  14. Sub MonitorCreation()
  15. strComputer = "."
  16. Set objWMIService = GetObject("winmgmts:" _
  17.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  18. Set colMonitoredProcesses = objWMIService. _        
  19.     ExecNotificationQuery("select * from __instancecreationevent " _
  20.         & " within 1 where TargetInstance isa 'Win32_Process'")
  21. i = 0
  22. Do While i = 0
  23.     Set objLatestProcess = colMonitoredProcesses.NextEvent
  24.     Wscript.Echo Now() & "   Process Created: " & vbCrLf & objLatestProcess.TargetInstance.CommandLine & vbCrLf
  25. Loop
  26. End Sub
  27. Sub MonitorDeletion()
  28. strComputer = "."
  29. Set objWMIService = GetObject("winmgmts:" _
  30.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  31. Set colMonitoredProcesses = objWMIService. _
  32.     ExecNotificationQuery("select * from __instancedeletionevent " _
  33.             & "within 1 where TargetInstance isa 'Win32_Process'")
  34. i = 0
  35. Do While i = 0
  36.     Set objLatestProcess = colMonitoredProcesses.NextEvent
  37.     Wscript.Echo Now() & "   Process Deleted: " & vbCrLf & objLatestProcess.TargetInstance.CommandLine & vbCrLf
  38. Loop
  39. End Sub
复制代码

TOP

很好,很好,很有启发,谢谢!

TOP

厉害啊!
我看都没看懂!
不过我认为用进程比较就行了吧!
把开始的进程罗列!
本人已死!不用联系!~
要联系下来联系!~~

TOP

返回列表