PowerShell Here-string


Example

Here-strings are very useful when creating multiline strings. One of the biggest benefits compared to other multiline strings are that you can use quotes without having to escape them using a backtick.

Here-string

Here-strings begin with @" and a linebreak and end with "@ on it's own line ("@must be first characters on the line, not even whitespace/tab).

@"
Simple
    Multiline string 
with "quotes"
"@

Literal here-string

You could also create a literal here-string by using single quotes, when you don't want any expressions to be expanded just like a normal literal string.

@'
The following line won't be expanded
$(Get-Date)
because this is a literal here-string
'@