Strings

In PowerShell, single quotes (’) and double quotes (") are used to represent strings.

Single quote (’) and double quote (")

There is a difference between single quotes and double quotes as follows
Single quote: the string remains unchanged
Double quote: the variable is expanded and becomes a string

PS> $num = 1
PS> 'Number $num'
Number $num
PS> "Number $num"
Number 1

${}

If there is no space after the variable, use ${}.

PS> $str = "Hello "
PS> ${str}World
Hello World
PS> $strWorld

$()

If $() is used within double quotes, the contents of the parentheses will be treated as an expression.
This is useful when you want to expand XML parameters into a string.

Example

Terminal

PS> "$(2+3)"
5
PS> $xml = [xml](Get-Content .\XML.xml)
PS> "$xml.parameter" # The dot prevents the expected variable expansion.
System.Xml.XmlDocument.parameter
PS> "$($xml.parameter)" # You can use $() to expand it.
パラメーター

Contents of XML.xml

<?xml version="1.0" encoding="UTF-8"?>
<parameter>Parameter</parameter>

Here string

For multi-line string descriptions, it is convenient to use the here string.
If you want to expand a variable, use @""@.
To not expand a variable, use @’’@

PS> $text = @"
>> This
>> is
>> a
>> pen
>> "@
>>
PS> $text
This
is
a
pen

YouTube

Click here for a video explanation.

Everything you wanted to know about variable substitution in strings | Microsoft Docs