VBS Command Line

From iMacros

Jump to: navigation, search

This example demonstrates how pass values to a VBS script with WScript.Arguments from the command line. You can use this, for example, to start a VBS file from batch files or the Windows task scheduler.

 If WScript.Arguments.Count = 3 Then
  Macro1 = WScript.Arguments.Item(0)
  Macro2 = WScript.Arguments.Item(1)
  Macro3 = WScript.Arguments.Item(2)
 Else
  Wscript.Echo "Usage: MyScript.vbs Macro1 Macro2 Macro3"
  Wscript.Quit
 End If