PowerShell offers many different options when it comes to displaying your data. One of my favorites is changing the foreground and background colors of text. This is probably because way back (circa 1985) I used the Inverse and Flash commands do make different parts of my Applesoft Basic programs stick out. This is also an improvement on the MS DOS command prompt we so often work with. It only has two colors, foreground and background. Below is the syntax to write text in color on both the Shell, and the ISE.
Write-Host “Text to display” –ForegroundColor ColorValue –BackgroundColor ColorValue2
Here are you valid choices for each color value:
Write-Host “Text to display” –ForegroundColor ColorValue –BackgroundColor ColorValue2
Here are you valid choices for each color value:
- Black
- DarkBlue
- DarkGreen
- DarkCyan
- DarkRed
- DarkMagenta
- DarkYellow
- Gray
- DarkGray
- Blue
- Green
- Cyan
- Red
- Magenta
- Yellow
- White
Comments