Display message on screen (host user interface).
Syntax
Write-Host [[-object] Object] [-noNewLine] [-separator Object]
[-foregroundcolor ConsoleColor] [-backgroundColor ConsoleColor]
[CommonParameters]
Key
-object Object
Object to display, typically a string.
-noNewLine
Do not end with a newline character.
-separator
String to output between objects displayed on the console.
-foregroundcolor ConsoleColor
The text color
-backgroundcolor ConsoleColor
Background color
ConsoleColors:
Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow,
Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.
Examples
Display some text in green:
PS C:\>write-host "The quick brown fox jumped" -foregroundcolor DarkGreen -backgroundcolor white
“In our life there is a single color, as on an artist's palette, which provides the meaning of life and art. It is the color of love” - Marc Chagall
Related Powershell Commands:
Clear-Host - Clear the screen
Out-Host - Send the pipelined output to the host
Write-Debug - Write a debug message to the host display
Write-Warning - Write a warning message