Cmder: 最新 Windows 更新后,powershell 输出颜色为绿色

创建于 2019-05-15  ·  3评论  ·  资料来源: cmderdev/cmder

在应用了最新 ui 更新的 Windows 10 上使用 cmder 版本 1.3.11.843。

更新后,powershell 的输出状态为绿色。 我已将其跟踪到 profile.ps1 第 104 行

Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green

Green被删除/更改为白色时,这解决了问题,但当然也会更改密码颜色。

此外, ctr+l 似乎行为不端并导致不必要的滚动 - 不过我还没有重现的确切步骤。

更新前不存在问题。

编辑:

λ  $host.UI.RawUI


ForegroundColor       : Green
BackgroundColor       : Black
CursorPosition        : 0,127
WindowPosition        : 0,70
CursorSize            : 25
BufferSize            : 214,1000
WindowSize            : 214,58
MaxWindowSize         : 214,191
MaxPhysicalWindowSize : 214,58
KeyAvailable          : False
WindowTitle           : posh~git

最有用的评论

将 PSReadline 更新到最新版本 (beta4) 解决了这两个问题。

所有3条评论

将 PSReadline 更新到最新版本 (beta4) 解决了这两个问题。

Install-Module -Name PSReadLine -AllowPrerelease
安装新的PsReadline

您可能会遇到错误:
Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'

要解决此问题,您需要安装最新版本的 PowerShellGet:
Install-Module PowershellGet -Force

更新

在另一台机器上的实际安装过程(Windows 10 1903,Build 18362.239,cmder 180262 preview)是这样的:

  • 打开cmder
  • 打开管理 PowerShell
  • 执行Install-Module PowershellGet -Force
  • 重启cmder
  • 打开管理 PowerShell
  • 执行Install-Module -Name PSReadLine -AllowPrerelease -Force安装 2.0.0-beta4 版本(之前安装了 2.0.0-beta2)
  • 控制台颜色恢复正常

我收到有关管理员权限的错误。 因为 PowerShell 正在运行。 所以它使用PSReadLine并防止它被覆盖。

以管理员身份打开cmd并运行

powershell -Command "Install-Module -Name PSReadLine -AllowPrerelease -Force"

解决我的问题。

谢谢你。 升级PSReadLine解决了我的问题。 😊

此页面是否有帮助?
0 / 5 - 0 等级