Q. How can I display output in Windows PowerShell?Q. How can I display output in Windows PowerShell?
This is a common question from folks who are used to using something like VBScript's WScript.Popup or WScript.Echo. There are a few choices.
July 5, 2010
Q. How can I display output in Windows PowerShell?
A. This is a common question from folks who are used to using something like VBScript's WScript.Popup or WScript.Echo. There are a few choices. I like to use the Write-Debug cmdlet to display debug output. It's suppressed by default, since the shell's $DebugPreference variable is set to SilentlyContinue. Temporarily change it to Continue to enable debug output.
For normal output, you can use the Write-Host cmdlet to write directly to the screen or the Write-Output cmdlet to write to the pipeline. PowerShell doesn't include a graphical message box, although you could access one from within the .NET Framework. Doing so, however, kind of defeats the purpose of a command-line environment, right?
Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.
About the Author
You May Also Like