标题: 转载一个进程监视的VBS脚本 [打印本页]
作者: lxzzr 时间: 2009-4-8 13:57 标题: 转载一个进程监视的VBS脚本
-
- On Error Resume next
- if LCase(Right(WScript.FullName,11))=LCase("WScript.exe") then
- CreateObject("WScript.Shell").run _
- "CScript //nologo " & Chr(34) & WScript.ScriptFullName & Chr(34)
- WScript.Quit
- end if
- '================================================================================
- strComputer = "."
- Set objWMIService = GetObject("winmgmts:" _
- & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
- Set colMonitoredProcesses = objWMIService. _
- ExecNotificationQuery("select * from __instancecreationevent " _
- & " within 1 where TargetInstance isa 'Win32_Process'")
- i = 0
- Do While i = 0
- Set objLatestProcess = colMonitoredProcesses.NextEvent
- Wscript.Echo objLatestProcess.TargetInstance.Name
- Wscript.Echo objLatestProcess.TargetInstance.ExecutablePath
- Wscript.Echo objLatestProcess.TargetInstance.CommandLine & vbCrLf
- Loop
- '================================================================================
- WScript.StdOut.Write vbCrLf & "Press Enter key or Ctrl+C to exit. . . "
- WScript.StdIn.ReadLine
复制代码
将上面的代码保存为*.vbs即可
作者: feng 时间: 2009-6-18 13:58
请问版主,这个怎么用呀
作者: RottenC 时间: 2009-7-31 18:12
請問版主方面也上上代碼的註釋好嗎,爲了學習.
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |