What’s the difference between “Write-Host”, “Write-Output”, or “[console]::WriteLine”?

There are a number of different ways to output messages. What is the effective difference between outputting something via Write-Host, Write-Output, or [console]::WriteLine?

I also notice that if I use:

write-host "count=" + $count

The + gets included in the output. Why’s that? Shouldn’t the expression be evaluated to produce a single concatenated string before it gets written out?

6 Answers
6

Leave a Comment