[英]Using “Run with Powershell” to invoke a script won't show a DarkMagenta background
我在ps1文件中有以下脚本:
Write-Host "Hello world" -ForegroundColor White -BackgroundColor DarkMagenta
如果我自己打开一个Powershell窗口并调用脚本(仅通过运行。\\ myscript.ps1 ),那么我会得到一个很好的深洋红色背景。 但是,如果我右键单击ps1文件并选择“使用Powershell运行”,则不会得到深洋红色的背景。 其他背景颜色也可以。
这是怎么回事,如何使它们表现相同?
16种控制台颜色由HKCU:控制台下注册表中的ColorTable00
.. ColorTable15
或用于启动应用程序的任何其他快捷方式确定。
稍作修改的表显示了常规条目以及powershell的两个不同条目05和06。
Blue Green Red
> REG QUERY "hkcu\console" |find /I "ColorTable"
ColorTable00 REG_DWORD 0x000000 0 0 0
ColorTable01 REG_DWORD 0x800000 128 0 0
ColorTable02 REG_DWORD 0x008000 0 128 0
ColorTable03 REG_DWORD 0x808000 128 128 0
ColorTable04 REG_DWORD 0x000080 0 0 128
ColorTable05 REG_DWORD 0x800080 128 0 128
ColorTable06 REG_DWORD 0x008080 0 128 128
ColorTable07 REG_DWORD 0xc0c0c0 192 192 192
ColorTable08 REG_DWORD 0x808080 128 128 128
ColorTable09 REG_DWORD 0xff0000 255 0 0
ColorTable10 REG_DWORD 0x00ff00 0 255 0
ColorTable11 REG_DWORD 0xffff00 255 255 0
ColorTable12 REG_DWORD 0x0000ff 0 0 255
ColorTable13 REG_DWORD 0xff00ff 255 0 255
ColorTable14 REG_DWORD 0x00ffff 0 255 255
ColorTable15 REG_DWORD 0xffffff 255 255 255
Blue Green Red
HKCU\console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
ColorTable05 REG_DWORD 0x562401 1 86 36
ColorTable06 REG_DWORD 0xf0edee 238 237 240
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.