8

I want to automate a task for a telnet session on Windows so that I can run it multiple times using different values.

I have a .wsf script for doing that task for one time with hard coded values.

How can I parameterise the values of a .wsf script.

Is there any way for parameterizing, like using excel where I can store all the variables and pass them dynamically to the script?

Underoos
  • 4,708
  • 8
  • 42
  • 85

1 Answers1

2
<?xml version="1.0" ?><job><script language="VBScript">
<![CDATA[

Set a = WScript.Arguments
Dim i
i = 0
While a.length > i
    WScript.Echo WScript.Arguments(i)
    i = i + 1
Wend

]]>
</script></job>

and run it as wscript.exe myfile.wsf param1 "pa r a m 2" param3

Anders
  • 97,548
  • 12
  • 110
  • 164
  • "Unsupported 16-Bit Application" which reads as-follows: "The program or feature "\??\C:\Users\Windows\wscript.exe" cannot start or run due to incompatibility with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available." – Underoos Apr 04 '17 at 14:49
  • You must have a strange wscript.exe somewhere, use %windir%\system32\wscript.exe – Anders Apr 04 '17 at 16:16