Board logo

标题: VBS如何向批处理传递命令行参数 [打印本页]

作者: spfnug    时间: 2009-11-30 20:25     标题: VBS如何向批处理传递命令行参数

如题,如何将参数传递给check.bat,即执行"check %1"
  1. strComputer = "."
  2. set objectShell=wscript.createObject("wscript.shell")
  3. Set objWMIService = GetObject("winmgmts:" _
  4.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  5. Set colMonitoredProcesses = objWMIService. _        
  6.     ExecNotificationQuery("select * from __instancecreationevent " _
  7.         & " within 1 where TargetInstance isa 'win32_process'")
  8. i = 0
  9. Do While i = 0
  10.     Set objLatestProcess = colMonitoredProcesses.NextEvent
  11.     objectShell.Run "check.bat %1", 1, TRUE
  12. Loop
复制代码

作者: zqz0012005    时间: 2009-11-30 20:58

objectShell.Run "check.bat " & objLatestProcess.TargetInstance.Name, 1, TRUE




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