about_Quoting_Rules.help

about_Quoting_Rules.help - TOPIC about_Quoting_Rules SHORT...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 TOPIC about_Quoting_Rules SHORT DESCRIPTION Describes rules for using single and double quotation marks in Windows PowerShell. LONG DESCRIPTION Quotation marks are used to specify a literal string. You can enclose a string in single quotation marks (') or double quotation marks ("). Quotation marks are also used to create a here-string. A here-string is a single-quoted or double-quoted string in which quotation marks are interpreted literally. A here-string can span multiple lines. All the lines in a here-string are interpreted as strings, even though they are not enclosed in quotation marks. In commands to remote computers, quotation marks define the parts of the command that are run on the remote computer. In a remote session, quotation marks also determine whether the variables in a command are interpreted first on the local computer or on the remote computer. Single and Double-Quoted Strings When you enclose a string in double quotation marks (a double-quoted string), variable names that are preceded by a dollar sign ($) are replaced with the variable's value before the string is passed to the command for processing. For example: $i = 5 "The value of $i is $i." The output of this command is: The value of 5 is 5. Also, in a double-quoted string, expressions are evaluated, and the result is inserted in the string. For example: "The value of $(2+3) is 5." The output of this command is:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 The value of 5 is 5. When you enclose a string in single-quotation marks (a single-quoted string), the string is passed to the command exactly as you type it. No substitution is performed. For example:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

about_Quoting_Rules.help - TOPIC about_Quoting_Rules SHORT...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online