PowerShell: Here-String (block quote for big text)
What is Here-String
Here-string is a syntax for quoting long multi-lines text.
Here-String with APOSTROPHE delimiter (Literal)
Syntax
$x = @'
text_body
'@
- text_body is the string.
- text_body can be multiple lines.
- text_body is taken literally. No special interpretation.
- The last line of text_body does not include the newline character.
@'must be on its own line.'@must be on its own line.
Example
$x = @' some '@ $x -eq 'some' # True
Here-String with QUOTATION MARK delimiter (Interpreted)
Syntax
$x = @"
text_body
"@
Similar to Here-String with APOSTROPHE delimiter, except that dollar sign $ sequence are considerd as expressions and GRAVE ACCENT ` is escape sequence.
Example
$x = 3 $text = @" aa`nbb $x cats "@ $text <# aa bb 3 cats #>