How to Output Bold Text in PowerShell (With Example)


You can use the Write-Host cmdlet in PowerShell to output text to the console.

In order to display bold text in the output, you can use -Foreground White to specify that the foreground color should be white instead of the default grey color, which makes the white text appear bold:

Write-Host 'Here is some ' -NoNewline; Write-Host -ForegroundColor White 'bold ' -NoNewline; Write-Host 'text'

This particular example will produce the following output:

  • Here is some bold text

The following example shows how to use this syntax in practice.

Example: How to Output Bold Text in PowerShell

Suppose that you would like to use the Write-Host cmdlet in PowerShell to display the text “Here is some bold text” to the console.

Suppose that we use the following syntax to do so:

Write-Host 'Here is some bold text'

The following screenshot shows how to use this syntax in practice:

Now suppose that we would like the word “bold” to appear in bold font.

We can use the following syntax to do so:

Write-Host 'Here is some ' -NoNewline; Write-Host -ForegroundColor White 'bold ' -NoNewline; Write-Host 'text' 

The following screenshot shows how to use this syntax in practice:

PowerShell bold text

Notice that the word “bold” now appears in bold font in the output.

This is because the word “bold” has the color white while all other text in the output has the color grey.

This has the effect of making the word “bold” appear bold compared to the other text.

Note: You can find the complete documentation for the Write-Host cmdlet in PowerShell here.

Related Tutorials

The following tutorials explain how to perform other common tasks in PowerShell:

PowerShell: How to Use Write-Host with Specific Colors
PowerShell: How to Use Write-Host to Display Multiple Lines
PowerShell: How to Use Write-Host and Display Tab Character

Leave a Reply