[英]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. 我有一个名为
conApp.exe
的可执行程序,该程序从BIOS中检索信息并将其作为文本字符串显示在屏幕上。
So, if I type conApp.exe
from an elevated command prompt, I get the text string displayed to the screen 因此,如果我从提升的命令提示符下键入
conApp.exe
,我将在屏幕上显示文本字符串。
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. 我想做的是将conApp.exe生成的文本字符串传递到VBScript文件中的变量中,然后在VBScript中操纵该文本。
for example; 例如;
testscript1.vbs conApp.exe
How can I do this? 我怎样才能做到这一点?
Thanks, 谢谢,
Dave 戴夫
Use WScript.StdIn in your .vbs and feed it via | 在您的.vbs中使用WScript.StdIn并通过| (pipe):
(管):
copy con double.vbs
WScript.Echo 2 * CInt(WSCript.StdIn.ReadLine())
^Z
echo 2 | cscript double.vbs
4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.