Multiline string
suggest changeThere are multiple ways to create a multiline string in PowerShell:
- You can use the special characters for carriage return and/or newline manually, or use
[environment]::NewLineto insert the system's newline value:
"Hello`r`nWorld"
"Hello{0}World" -f [environment]::NewLine
- Create a line break while defining a string (before the closing quote):
"Hello
World"
- Use a here-string. This is the most common technique.
@"
Hello
World
"@
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents