0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【小ネタ】Win11のダークモードをPowerShellで切り替える

Last updated at Posted at 2024-12-22

内容

  • Win11のダークモードとライトモードをトグルするスクリプトとなります。
  • 設定を開くのがめんどうだったため。
.ps1
$currentTheme = Get-ItemPropertyValue -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme; Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value (1 - $currentTheme) -Type DWord -Force; Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value (1 - $currentTheme) -Type DWord -Force; Write-Host ($(if($currentTheme -eq 1){"ダークモード"}else{"ライトモード"}) + "に切り替えました。") -ForegroundColor $(if($currentTheme -eq 1){"Green"}else{"Yellow"}); Stop-Process -Name explorer -Force; Start-Process explorer.exe

2025/2/2 ワンライナーに変更

実行イメージ

image.png

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?