Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Windows 10 實現夜間模式/深色模式快速切換(PowerShell 腳本)

編輯:Win10 系統應用技巧

Windows 10 深色模式(黑色主題)無內建快速切換開關,可編寫 PowerShell 腳本一鍵切換:

建立切換腳本

  1. 新建文字檔,貼入以下程式碼:
$regkey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$name = "AppsUseLightTheme"
$exists = Get-ItemProperty -Path "$regkey" -Name "$name" -ErrorAction SilentlyContinue
If (($exists -ne $null) -and ($exists.Length -ne 0)) {
    Remove-ItemProperty -Path $regkey -Name $name
} Else {
    New-ItemProperty -Path $regkey -Name $name -Value 0
}
  1. 另存為 ToggleDarkMode.ps1(副檔名 .ps1)。
  2. 右鍵點擊 .ps1 檔案 → 「使用 PowerShell 執行」,即可切換深色/淺色模式。再次執行可切回。

深色模式切換示意

注意: 早期版本深色模式未完善,啟用後設定視窗標題列可能變黑導致文字按鈕不可見。此為暫時性腳本方案,正式版後續更新已在「設定」→「個人化」→「顏色」提供「選擇模式」下拉選單(淺色/深色/自訂)原生支援切換。

Copyright © Windows教程網 All Rights Reserved