如何在 Powershell 中将字符串保存为原始数据?

Ale*_*x58 4 powershell

我想设置一个包含特殊字符的字符串(例如 $)。如何将字符串保存为原始字符串?

$B = "A$$B" 不会保存为 "A$$B"。

谢谢。

man*_*lds 6

如果字符串位于'(单引号)中,则变量(如$x)不会扩展。

此外,Powershell 与here-stringsC# 中的逐字字符串非常相似

http://blogs.msdn.com/b/powershell/archive/2006/07/15/variable-expansion-in-strings-and-herestrings.aspx