O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Escaping Characters

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.

Note

You can execute the Get-Help about_escape_character command in PowerShell for more information and examples.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required