When scripting in PowerShell, it’s often useful to change the text and background colors to make certain outputs stand out. The Write-Host
cmdlet in PowerShell allows for this customization. Here are some of the colors you can use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow Gray DarkGray Blue Green Cyan Red Magenta Yellow White |
You can set the text color using the ForegroundColor
parameter and the background color using the BackgroundColor
parameter.
Exemple
1 | write-host "message" -BackgroundColor Yellow -ForegroundColor Black |
This command will display the word “message” with a yellow background and black text.
0 Comments