Powershell:我们可以改变Write-Progress UI吗?

Far*_*eed 5 powershell user-interface

是否可以更改Write-Progress配色方案和其他UI内容,例如进度条?

目前,它的浅绿色带有由"O"组成的进度条......我想改变颜色(或删除颜色)并用其他东西替换"O".

alr*_*roc 9

您可以更改的前景色和背景色Write-Progress通过修改输出ProgressForegroundColorProgressBackgroundColor对的对象.$host.privatedata ConsoleColorProxy

例如,如果你真的讨厌你的眼睛:

$host.privatedata.ProgressForegroundColor = "darkgreen";
$host.privatedata.ProgressBackgroundColor = "red";
Run Code Online (Sandbox Code Playgroud)

  • 是的,它就像一个魅力。我只能使用以下命令将进度条的背景颜色与控制台的背景颜色相匹配:“$Host.PrivateData.ProgressBackgroundColor=$Host.UI.RawUI.BackgroundColor” (2认同)