How to parameterise .wsf scripts for telnet sessions?
Asked Answered
A

1

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?

Associate answered 4/4, 2017 at 13:46 Comment(0)
S
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

Starch answered 4/4, 2017 at 14:28 Comment(2)
"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."Associate
You must have a strange wscript.exe somewhere, use %windir%\system32\wscript.exeStarch

© 2022 - 2024 — McMap. All rights reserved.