- Open a powershell Window
- Windows Start menu -> Type powershell, and Click on PowerShell from the menu listing
- Once the Powershell window is opened, type the command Write-Host YourText, example below
PS C:\Users\codetryout> Write-Host Hello World
Hello World
It is a better practice to quote your text, as shown below
PS C:\Users\dev> Write-Host "Hello World"
Hello World
You may apply some colors to your printed text.
Examples for setting the text color (the actual output text will be in red color):
PS C:\Users\dev> Write-Host "Hello World" -ForegroundColor red
Hello World
To set a background color (the actual output text background will be in green)
PS C:\Users\dev> Write-Host "Hello World" -BackgroundColor green
Hello World
Setting both text color and background color, (text in red and background color in green)
PS C:\Users\dev> Write-Host "Hello World" -BackgroundColor green -ForegroundColor red
Hello World
Here is the complete reference to all supported colors: Powershell Write-Host supported colors