If you want to format a string when echoing to the screen, use parentheses.

Echo("This is {0} " -f "a test.")

 

Will output:

This is a test.

 

Note

http://stackoverflow.com/questions/17623644/what-is-the-difference-between-echo-and-write-host-in-powershell

echo is an alias for Write-Output, which writes to the Success output stream. This allows output to be processed through pipelines or redirected into files. Write-Host writes directly to the console, so the output can’t be redirected/processed any further.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.