Search code examples
windowsvbscriptautomated-teststelnetwsh

How to parameterise .wsf scripts for telnet sessions?


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?


Solution

  • <?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