Converting the Windows Script Host ReadAll Method

Definition: Returns all characters from an input stream.


The ReadAll method is designed to read all the data entered into one of the standard I/O data streams (StdIn, StdOut, and StdErr). How useful is that? To be honest, not all that useful; after all, most of the data entered into a script comes from the user typing something at the command-prompt. That’s no problem except that, by definition, data must be entered one line at a time; as soon as the user presses ENTER, the script reads whatever has been typed in. ReadAll does allow you to pipe data into a script using a command similar to this (in this case, the ReadAll method would be deployed within Test.vbs):

dir *.* | Cscript C:\Scripts\Test.vbs

But, to tell you the truth, we aren’t sure how often you need to do that. If you ever do, however, data can be piped to most Windows PowerShell cmdlets without the need for an intermediary such as ReadAll:

dir *.* | Out-File C:\Scripts\Filelist.txt

See conversions of other Windows Script Host methods and properties.
Return to the VBScript to Windows PowerShell home page