Powershell Write-Host Line Breaks In Different Scripts
I have 2 different scripts with line breaks. One of them won’t make line breaks without “n" at the end of each line. She this example with and without the "
n”.
Why Do Some Powershell Scripts Need `n` For New Text Lines
I have spent the last few months make PowerShell scripts to do various custom tasks. Recently I have seen an issue where some Powershell scripts when I use Write-Host
lines, for new lines to show up in the output, I have to use the "
n”at the end of each line within
Write-Host. Other scripts I don't have to do this. I can't find a lot of information on this as to why it wants me to do this as other scripts I write I don't have to use this tag. In other scripts I can use just a normal line break within the
Write-Hostblock and it will make a line break. In some it won't make the line break without the
“n"
.