Export (0) Print
Expand All
Expand Minimize
5 out of 5 rated this helpful - Rate this topic

Using the Write-Warning Cmdlet

Writing a Warning Message to the Console Window

The Write-Warning cmdlet is designed to write a warning message to the screen. What’s cool about Write-Warning is that this message appears, by default, in bright yellow, making it clearly stand out in the console window:

Windows PowerShell


Write-Warning is also one of the simplest of all cmdlets; all you do is call Write-Warning followed by the warning message you want to display:



Write-Warning "The folder C:\Scripts2 does not exist."

That’s all there is to it.

Related Links

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.