.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 objShell = WScript.CreateObject("WScript.Shell") Set ObjExec = objShell.Exec("cmd.exe /c dir") Do strFromProc = ObjExec.StdOut.ReadLine() WScript.Echo "ABC " & strFromProc & " DEF" Loop While Not ObjExec.Stdout.atEndOfStream

“The unexamined life is not worth living” ~ Socrates

Related VBScript commands

InputBox - Prompt for user input.
.StdOut.Write - Text output.
Equivalent PowerShell cmdlet: Read-Host - Read a line of input from the host console.


 
Copyright © 1999-2023 SS64.com
Some rights reserved