cscript test.vbs a b c
wscript test.vbs a b c
There are very few differences between cscript and wscript. Cscript is a console-based application and runs inside an MS-DOS box. The first command uses cscript to run test.vbs with a, b, and c as the command line parameters (arguments). The second command uses wscript to run test.vbs and has a, b, c as the command line parameters.
To get the command line parameters inside the VBS file please use:
Code: Select all
set args = WScript.Arguments
num = args.Count
if num = 0 then
WScript.Echo "No command line parameters!"
WScript.Quit 1
end if
for k = 0 to num - 1
msgbox args.Item(k)
next