PowerShell: Quoting -replace & variables
问题 This is in response to my previous question: PowerShell: -replace, regex and ($) dollar sign woes My question is: why do these 2 lines of code have different output: 'abc' -replace 'a(\w)', '$1' 'abc' -replace 'a(\w)', "$1" AND according to the 2 articles below, why doesn't the variable '$1' in single quotes get used as a literal string? Everything in single quotes should be treated as a literal text string, right? http://www.computerperformance.co.uk/powershell/powershell_quotes.htm http:/