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 on quotation marks and PowerShell, see the Microsoft article about_Quoting_Rules.
Double quotation marks
Double quotation marks define an expandable or dynamic string. Information that is entered between the quotation marks "here"
is computed using any special actions defined inside the string.
For example, if the string entered is "abcd$1234"
then the string will be computed as containing the variable $1234
.
In the the ShareGate migration tool Powershell articles, you will see double quotation marks are used for the majority of parameters that are alphanumeric, 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 the the ShareGate migration tool PowerShell articles, you will see that single quotation marks are used for password
examples because a secure and complex password needs to be computed as written.
Creating your script
Use the PowerShell examples found in the the ShareGate migration tool documentation as a guide, then adjust your script so that it will work for you.