Board logo

标题: 转载一个进程监视的VBS脚本 [打印本页]

作者: lxzzr    时间: 2009-4-8 13:57     标题: 转载一个进程监视的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即可
作者: feng    时间: 2009-6-18 13:58

请问版主,这个怎么用呀
作者: RottenC    时间: 2009-7-31 18:12

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




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2