In Windows PowerShell, single quotation marks (') and double quotation marks (") are used as the boundary when defining a string. That is, the quotation mark indicates the beginning and end of your information. For example, when using the parameter
-URL, the string
"http://myfarm1/sites/mysourcesite" is enclosed in double quotation marks.
In this article, you will find a brief summary of the rules that single and double quotation marks follow in PowerShell.
For a more detailed explanation of quotation marks and PowerShell, see the Microsoft article about_Quoting_Rules.
Double quotation marks
Double quotation marks define an expandable or dynamic string. Information entered between double quotation marks is computed when special actions are defined inside the string.
For example, if the string entered is
"abcd$1234" then the string will be computed as containing the variable
$ defines a variable in PowerShell.
In ShareGate's migration tool Powershell articles, you will see double quotation marks are used for most alphanumeric parameters, such as usernames or file names.
Single quotation marks
When you use single quotation marks, the string is computed as written. It is said that single quotation marks define a verbatim string or literal string.
In ShareGate's migration tool PowerShell articles, you will see that single quotation marks are used for
password examples because a secure and complex password can contain symbols considered an action in a dynamic string.