Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

PowerTip: Display Message in 16 Colors

$
0
0

Summary: Use Windows PowerShell to display a message in 16 colors.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily display a message in 16 different colors to start my presentation
           with something a little different?

Hey, Scripting Guy! Answer Use the range operator to create 16 numbers. Pipe the numbers to the Foreach-Object cmdlet. In the
           script block, use Write-Host, and specify the foreground color as the number.
           Here is the command (using aliases for conciseness):

0..15 | %{write-host -f $_ 'hi'}


Viewing all articles
Browse latest Browse all 34890

Trending Articles



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