⚡ PowerShell 5.1+

Enable Dark Mode

Switches File Explorer and other system surfaces to dark mode.

By WindowsScripting.com · 689 B
Set-DarkMode.ps1
<#
.SYNOPSIS
    Enable Dark Mode.

.DESCRIPTION
    Switches File Explorer and other system surfaces to dark mode.

    Sets HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize \ AppsUseLightTheme to 0.

.EXAMPLE
    .\Set-DarkMode.ps1
#>

[CmdletBinding()]
param()

$regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize'

if (-not (Test-Path $regPath)) {
    New-Item -Path $regPath -Force | Out-Null
}

New-ItemProperty -Path $regPath -Name 'AppsUseLightTheme' -Value 0 -PropertyType DWord -Force | Out-Null

Write-Host "Enable Dark Mode applied. Sign out and back in (or restart explorer.exe) for it to fully take effect." -ForegroundColor Green