![]() ![]() ![]() InformationAction parameter with the Ignore Value to suppress output to the information stream. These commands effectively suppress output of the Write-Host cmdlet. ![]() Write-Host "I won't print" -InformationAction Ignore Example 5: Suppress output from Write-Host # The following two statements can be used to effectively suppress output from Write-Host The background is white, as defined by the BackgroundColor This command displays the string "Red on white text." The text is red, as defined by theįoregroundColor parameter. Example 4: Write with different text and background colors Write-Host "Red on white text." -ForegroundColor red -BackgroundColor white Parameter to output dark green text and the BackgroundColor parameter to display a whiteīackground. This command displays the even numbers from two through twelve. Example 3: Write with different text and background colors Write-Host (2,4,6,8,10,12) -Separator ", -> " -ForegroundColor DarkGreen -BackgroundColor White To add the string, +2= (comma, space, +, 2, =, space). Example 2: Write to the console and include a separator Write-Host (2,4,6,8,10,12) -Separator ", +2= " This command displays the string 'no newline test' with the NoNewline parameter.Ī second string is written, but it ends up on the same line as the first due to the absence of a (see "Example 5") Examples Example 1: Write to the console without adding a new line Write-Host "no newline test " -NoNewline The exception to this rule is -InformationAction Ignore, whichĮffectively suppresses Write-Host output. The $InformationPreference preference variable and InformationAction common parameter do notĪffect Write-Host messages. Suppression of data written using Write-Host while preserving backwards compatibility. You to use Write-Host to emit output to the information stream. Starting in Windows PowerShell 5.0, Write-Host is a wrapper for Write-Information This allows ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |