If you have a VBScript program that would be better utilized if you can pass one or more parameters at run time, you can easily do so by accepting them as arguments.
Here is an example of how the program would be run from the command prompt (separate the parameters with spaces).
filename.vbs parameter1 parameter2
WScript.Arguments to retrieve the parameters that were passed.
Dim Arg, var1, var2 Set Arg = WScript.Arguments 'Parameter1, begin with index0 var1 = Arg(0) 'Parameter2 var2 = Arg(1) msgbox "First parameter passed was " _ & var1 & " and second parameter passed was " & var2 'Clear the objects at the end of your script. set Arg = Nothing
You can use the approach for passing parameters in a command shell, or even a scheduled task. Passing parameters to a VBScript file allows you to reuse your VBScript program.