Expanding Strings And Environment Variables in PowerShell

Sunday, January 2, 2011

In PowerShell, when you enclose a string that contains variables (preceded by a dollar sign) in double quotation marks, the variables are replaced with the variable's value. For example: PS > $i = 5 PS > "The value of $i is $i." The value of 5 is 5. When the string is enclosed a string in single-quotation marks, the string is passed as is, no substitution is performed. PS > 'The value of $i is $i.' The value of $i is $i   What...