Here Strings in PowerShell

Image Description

Daily PowerShell #23

Scripting Daily PowerShell Basics

November 8, 2021

Here strings are interpreted literally and can include multiple lines.

You can define a here string in PowerShell by specifying a @ before the first quote and after the last quote.

@"
Hello!
World!
"@

Here strings can be either single or double quotes.

Double quoted strings will replace variables.

$World = "Earth!" 
@"
Hello!
$World
"@

Single quoted strings will not replace variables.

$World = "Earth!" 
@'
Hello!
$World
'@