Powershell -comobject wscript.shell 换行语法

Powershell -comobject wscript.shell New Line Syntax

我正在编写一个脚本来设置一些变量并弹出一个 window 以确认按钮显示这些变量。我能够到达 window 以显示后跟一个变量的文本,但无法弄清楚在通知 window 中转到下一行的语法。

`$user = Read-Host "Enter User Name"
$password = Read-Host "Enter Password"
$domain = Read-Host "Enter Domain. Local name is $env:COMPUTERNAME"
$a = new-object -comobject wscript.shell 
$a.popup("User Name:$user" & "Password:$password")`

我尝试了 `n 的不同组合,但无法弄清楚。

提前致谢

I have tried different combinations of `n and am not able to figure it out.

您是否尝试过在双引号字符串中间只 `n 而没有其他任何东西? :-)

$WShell = New-Object -ComObject WScript.Shell
$WShell.Popup("I wonder whether this`nlinebreak thing works")