Escape Single Quotes and Double Quotes in PowerShell
-
Use Backticks
`
to Escape Double Quotes in PowerShell -
Use Double Quotes
""
to Escape Single Quotes in PowerShell

The single quotes ''
and double quotes ""
are used to specify a literal string in PowerShell. You can define strings by enclosing them using single or double quotes.
Both quotes help to print the text in PowerShell. But sometimes, you may need to include quote characters in the output.
This tutorial will teach you to escape quotes and make them appear in a string in PowerShell.
Use Backticks `
to Escape Double Quotes in PowerShell
The backtick `
works as the escape characters in PowerShell. You can use them to escape double quotes in a string or script.
The following example includes literal double quotation marks in a string.
"`"Welcome to PowerShell Tutorial`""
Output:
"Welcome to PowerShell Tutorial"
Let’s see another example to escape double quotes and make them appear in the output.
"His name is `"James Bond`"."
Output:
His name is "James Bond".
Use Double Quotes ""
to Escape Single Quotes in PowerShell
You can enclose a string in double quotes to escape single quotes in PowerShell.
The following example includes literal single quotation marks in a string.
"'Welcome to PowerShell Tutorial'"
Output:
'Welcome to PowerShell Tutorial'
You can also use single quotes to escape double quotes in PowerShell. This command uses single quotes to escape double quotation marks in a string.
'"Welcome to PowerShell Tutorial"'
Output:
"Welcome to PowerShell Tutorial"
This way, you can easily escape single or double quotes to make them appear in the output. For additional information, see the description about_Quoting_Rules.
Related Article - PowerShell String
- Array of Strings in PowerShell
- Check if a File Contains a Specific String Using PowerShell
- Extract a PowerShell Substring From a String
- Extract Texts Using Regex in PowerShell
- Generate Random Strings Using PowerShell