TechNet
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

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

Show:
© 2016 Microsoft