将变量传递到start powershell命令

将变量传递到start powershell命令,powershell,Powershell,我希望在新的powershell窗口中运行命令时,将字符串变量传递给 $word = "bird" start PowerShell { echo $word; pause } 我如何做到这一点?不知何故,它在没有花括号的情况下工作得更好,并且使用双引号来解释变量。我猜脚本块通过启动进程转换为字符串。暗含“Powershell-Command” start powershell "echo $word; pause" 或者,这适用于呼叫接线员: start PowerShell "&

我希望在新的powershell窗口中运行命令时,将字符串变量传递给

$word = "bird"
start PowerShell { echo $word; pause }

我如何做到这一点?

不知何故,它在没有花括号的情况下工作得更好,并且使用双引号来解释变量。我猜脚本块通过启动进程转换为字符串。暗含“Powershell-Command”

start powershell "echo $word; pause"
或者,这适用于呼叫接线员:

start PowerShell "& { echo $word; pause }"
“Powershell-?”有点像是在说这个

-Command

...
If the value of Command is a script block, the script block must be enclosed
in braces ({}). You can specify a script block only when running PowerShell.exe 
in Windows PowerShell. 

...
If the value of Command is a string, Command must be the last parameter
in the command , because any characters typed after the command are
interpreted as the command arguments.

To write a string that runs a Windows PowerShell command, use the format:
    "& {<command>}"
where the quotation marks indicate a string and the invoke operator (&)
causes the command to be executed.
-命令
...
如果Command的值是脚本块,则必须将脚本块括起来
在大括号({})中。只能在运行PowerShell.exe时指定脚本块
在Windows PowerShell中。
...
如果Command的值是字符串,则Command必须是最后一个参数
在命令中,因为在命令之后键入的任何字符都是
解释为命令参数。
要编写运行Windows PowerShell命令的字符串,请使用以下格式:
"& {}"
其中引号表示字符串和调用运算符(&)
导致执行该命令。

$host.UI.RawUI.WindowTitle='title'
如果添加双引号,脚本中的工作将停止。我正在启动许多power shell窗口,我需要能够命名它们。我通过在标题部分添加回勾来解决这个问题。