Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Create Color Output from Commands

$
0
0

Summary: Learn to use the Write-Host PowerShell cmdlet to create color output from commands.

Hey, Scripting Guy! Question Someone told me the Write-Host cmdlet could create color output. Can you give me some samples of acceptable syntax?

Hey, Scripting Guy! Answer

a. Write-Host -ForegroundColor 12 "hi"

b. Write-Host -ForegroundColor 12 "hi" -BackgroundColor white

c. Write-Host -ForegroundColor blue -BackgroundColor white

d. Write-Host -ForegroundColor 2 hi

e. Write-Host -backgroundcolor 2 hi

f. Write-Host -backgroundcolor ("{0:X}" -f 2) hi

     for($i=0 ; $i -le 15 ; $i++) { write-host -foregroundcolor $i "hi" }


Viewing all articles
Browse latest Browse all 3333

Trending Articles


FLASHBACK WITH SIRASA FM AT GALGAMUWA 2022


Mp3 Download: Mdu - Mazola


Imitation gun was fired at motorist in Leicester road-rage incident


Ndebele names


MCKINNEY EMALINE “EMMA” OF WES...


Okra & Motia — The Workshop (Prod by Hammer)


Skint TV teen to be sentenced


Moondru Mudichu 19-09-2017 – Polimer tv Serial


YOSVANI JAMES Arrested by Miami-Dade County Corrections on Jan 10, 2017


Stories • Goddess Stepmom



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>