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:

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

write-host "message" -BackgroundColor Yellow -ForegroundColor Black

This command will display the word « message » with a yellow background and black text.


0 commentaire

Laisser un commentaire

Emplacement de l’avatar

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.