Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

16.3. Write-Host

Now that you can collect input, you’ll want some way of displaying output. The Write-Host cmdlet is one way—not always the best way, but it’s available to you, and it’s important that you understand how it works.

As figure 16.4 illustrates, Write-Host runs in the pipeline like any other cmdlet, but it doesn’t place anything into the pipeline. Instead, it writes directly to the hosting application’s screen. Because it does that, it’s able to use alternate foreground and background colors, through its -foregroundColor and -backgroundColor commandline parameters.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial