Don’t do that #3: Multiple Write-Host to add new lines

By | February 24, 2015

Don’t do that: I often see people who use multiple lines “Write-Host” to add new lines on the screen (as Write-Host send the output only to the screen).


Do that: You can use the special character `n for new line:  "`nOutput`n"

The result is the same but requires only one line.

special-character-new-line

Note: You can use Here-String in case you have to deal with multiple special characters:

here-string-powershell


previous-buttonnext-button

Leave a Reply

Your email address will not be published.