PowerShell Strings Here-string

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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
'@


Got any PowerShell Question?