[英]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.