Dave Adler
Dave Adler

Reputation: 119

Can I take the output of an exe program and pass that into a vbscript as a parameter

I have an executable program called conApp.exe, that retrieves information from BIOS and displays it to the screen as a string of text.

So, if I type conApp.exe from an elevated command prompt, I get the text string displayed to the screen

For example;

c:\windows\system32>conApp.exe
v1.02.13
c:\windows\system32>

Typically I redirect that output to a text file so I can use it in another script.

for example; c:\windows\system32>conApp.exe > biosVer.txt

What I would like to do is pass the string of text generated by conApp.exe into variable in a VBScript file and manipulate that text within the VBScript.

for example; testscript1.vbs conApp.exe

How can I do this?

Thanks,

Dave

Upvotes: 1

Views: 160

Answers (1)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38755

Use WScript.StdIn in your .vbs and feed it via | (pipe):

copy con double.vbs
WScript.Echo 2 * CInt(WSCript.StdIn.ReadLine())
^Z

echo 2 | cscript double.vbs
4

Upvotes: 2

Related Questions