【发布时间】:2019-12-05 16:25:22
【问题描述】:
以下命令适用于CMD (How to start powershell with a window title?)。
start powershell -NoExit -command "$Host.UI.RawUI.WindowTitle = 'bits'"
但它在 Powershell 中不起作用。
PS C:\> 启动 powershell -noexit -command "$Host.UI.RawUI.WindowTitle = 'test'; 读取主机" 启动进程:找不到与参数名称“noexit”匹配的参数。 在行:1 字符:18 + 启动 powershell -noexit -command "$Host.UI.RawUI.WindowTitle = 'test ... + ~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand以下命令可以打开一个新的powershell窗口。
start powershell "$Host.UI.RawUI.WindowTitle = 'test'; read-host"
但是,新窗口显示以下错误消息并且标题未设置。
System.Management.Automation.Internal.Host.InternalHost.UI.RawUI.WindowTitle :术语 'System.Management.Automation.Internal.Host.InternalHost.UI.RawUI.WindowTitle' 未被识别为 cmdlet、函数、脚本文件或可运行的程序。检查名称的拼写,或者如果包含路径,请验证 路径正确,然后重试。 在行:1 字符:1 + System.Management.Automation.Internal.Host.InternalHost.UI.RawUI.Wind ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (System.Manageme...wUI.WindowTitle:String) [], CommandNotFoundException +fullyQualifiedErrorId:CommandNotFoundException【问题讨论】:
-
start powershell '-NoExit -command "$Host.UI.RawUI.WindowTitle = ''bits''"'
标签: powershell