Converting the Windows Script Host Close Method

Definition: Closes a text stream.


Here’s the official definition of the Close method, as taken from the Windows Script Host language reference (emphasis added):

“The StdIn, StdOut, and StdErr properties and methods work when running the script with the CScript.exe host executable file only. An error is returned when run with WScript.exe. It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid. This method is provided for compatibility with the TextStream object.”

In other words, you don’t even need the Close method; consequently, we didn’t put too much effort into finding a Windows PowerShell equivalent. Although it shouldn’t be too hard for you to find an equivalent, i.e. something that you have absolutely no use for.

Hey, what are you looking at the Scripting Guys for?

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