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

转载一个进程监视的VBS脚本

  1. On Error Resume next
  2. if LCase(Right(WScript.FullName,11))=LCase("WScript.exe") then
  3.     CreateObject("WScript.Shell").run _
  4.         "CScript //nologo " & Chr(34) & WScript.ScriptFullName & Chr(34)
  5.     WScript.Quit
  6. end if
  7. '================================================================================
  8. strComputer = "."
  9. Set objWMIService = GetObject("winmgmts:" _
  10.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  11. Set colMonitoredProcesses = objWMIService. _        
  12.     ExecNotificationQuery("select * from __instancecreationevent " _
  13.         & " within 1 where TargetInstance isa 'Win32_Process'")
  14. i = 0
  15. Do While i = 0
  16.     Set objLatestProcess = colMonitoredProcesses.NextEvent
  17.     Wscript.Echo objLatestProcess.TargetInstance.Name
  18.     Wscript.Echo objLatestProcess.TargetInstance.ExecutablePath
  19.     Wscript.Echo objLatestProcess.TargetInstance.CommandLine & vbCrLf
  20. Loop
  21. '================================================================================
  22. WScript.StdOut.Write vbCrLf & "Press Enter key or Ctrl+C to exit. . . "
  23. WScript.StdIn.ReadLine
复制代码


将上面的代码保存为*.vbs即可

請問版主方面也上上代碼的註釋好嗎,爲了學習.

TOP

请问版主,这个怎么用呀

TOP

返回列表