-
- 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即可 |