.StdOut.ReadLine
Obtain User Input from the command prompt or retrieve (screen scrape) text from the output of a program.
Syntax
.StdOut.ReadLine()
Examples
' Read a single line into a variable
Dim strMyName
WScript.StdOut.Write("Enter Your full Name>")
WScript.StdIn.Read(0)
strMyName = WScript.StdIn.ReadLine()
WScript.StdOut.Write(strMyName)
' Read program output into a variable line by line
Dim ObjExec
Dim strFromProc
Set WshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = WshShell.Exec("cmd.exe /c dir")
Do
strFromProc = ObjExec.StdOut.ReadLine()
WScript.Echo "ABC " & strFromProc & " DEF"
Loop While Not ObjExec.Stdout.atEndOfStream
Input Function
You can also achieve similar functionality with
the VBScript function Inputbox()
InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])
Displays a prompt in a dialog box, waits for the user to input text
or click a button, and returns the contents of the text box. - example
"The unexamined life is not worth living" - Socrates
Related:
text output - .StdOut.Write