Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> 關於 Windows

Win7 修改 CMD 命令提示字元視窗背景顏色:登錄檔 DefaultColor 十六進制自訂

編輯:關於 Windows

Windows 7 預設命令提示字元 (CMD) 為黑底白字。若想自訂背景/前景顏色 (如白底黑字、藍底黃字),可透過 登錄檔 DefaultColor 值 設定,效果永久生效且不需第三方工具。本文說明十六進制色碼對照表與設定步驟。

設定步驟

  1. Win+R → 輸入 regedit → Enter 開啟登錄編輯器。
  2. 依序展開:
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor
  3. 右側尋找 DefaultColor (字串值/REG_SZ)。若不存在 → 右鍵空白處 → 新增 → 字串值 → 命名 DefaultColor。
  4. 雙擊 DefaultColor → 數值資料輸入 兩位十六進制字元:
    第一位 = 背景色、第二位 = 前景色 (文字色)。
  5. 確定 → 重新開啟 CMD 視窗即可看到新配色。

執行 regedit

Command Processor 登錄路徑

DefaultColor 設定範例

十六進制色碼對照表 (標準 16 色)

代碼顏色代碼顏色
0黑色8灰色
1藍色9淡藍色
2綠色A淡綠色
3淺綠色 (青色)B淡淺綠色
4紅色C淡紅色
5紫色D淡紫色
6黃色 (褐色)E淡黃色
7白色F亮白色

常用組合範例

  • 07 (預設) 黑底白字
  • F0 亮白底黑字 (類似記事本/IDE 風格)
  • 1F 藍底亮白字 (經典 DOS 藍畫面風格)
  • 2E 綠底淡黃字 (護眼綠)
  • 4F 紅底亮白字 (高對比警示風格)
  • 0A 黑底淡綠字 (駭客/終端機風格)

進階:CMD 內建 color 指令 (暫時生效)

CMD 視窗中直接輸入 color 1F (同上對照表) 即時變色,關閉視窗失效。登錄檔法為永久生效。

注意事項

  • 設定僅影響 cmd.exe,不影響 PowerShell (PowerShell 顏色設定於 $Host.UI.RawUI.BackgroundColor/ForegroundColor 或 Windows Terminal 設定檔)。
  • 若 Command Processor 鍵不存在,可手動建立 (右鍵 Microsoft → 新增項)。
  • Win8/8.1/10/11 同樣適用此登錄檔路徑。

一鍵設定: 管理員 CMD 執行 reg add "HKCU\Software\Microsoft\Command Processor" /v DefaultColor /t REG_SZ /d F0 /f 即可設為白底黑字。

Copyright © Windows教程網 All Rights Reserved