Often a special character may be used—for example, in DOS commands—but PowerShell tries to interpret it differently. Let’s consider the dollar sign character (
$). PowerShell normally tries to interpret it as a variable:
PS C:\> $var="$5 discount"PS C:\> $var discountPS C:\> $var="`$5 discount"PS C:\> $var$5 discountPS C:\>
The preceding example shows how the escape character, which is the backtick (`), is used to escape the dollar sign so that PowerShell doesn’t try to interpret the character literally as the beginning of a variable.
You can execute the
Get-Help about_escape_character command in PowerShell for more information and examples.