VBScript how to join WScript.Arguments?

command-line-arguments, vbscript, windows-7

Solution

`WshArgument` objects are not arrays, so you can't use `Join()` on them. What you can do is something like this:

ReDim arr(WScript.Arguments.Count-1)
For i = 0 To WScript.Arguments.Count-1
  arr(i) = WScript.Arguments(i)
Next

WScript.Echo Join(arr)

Problem

I am trying to join the arguments to a string to be passed to another script. The following: ``` WScript.Echo(Join(WScript.Arguments)) ``` gives me an error: ``` Error: Wrong number of arguments or invalid property assignment Code: 800A01C2 ``` What is wrong with that syntax?

Original source