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.

Don Jones

July 5, 2010

1 Min Read
PowerShell logo on light blue background with vertical lines

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.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like