PowerShell 脚本不接受 $(美元)符号

我尝试使用 PowerShell 脚本打开一个 SQL 数据连接,我的密码包含一个 $符号:

$cn = new-object system.data.SqlClient.SqlConnection("Data Source=DBNAME;Initial Catalog=Catagory;User ID=User;Password=pass$word;")

当我尝试打开一个连接时,它会说:

登录失败

71090 次浏览

Escape it by using backtick (`) as an escape character for the dollar sign ($).

Also, try to enclose the statement in single-quotes instead of the double-quotes you are using now.