powershell one liner toggle windows theme.ps1
reg query " HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" / v SystemUsesLightTheme |
Select-Object - first 3 |
Select-Object - last 1 |
% {
if ($_ -match " 0x1" ){
New-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name SystemUsesLightTheme - Value 0 - Type Dword - Force;
New-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name AppsUseLightTheme - Value 0 - Type Dword - Force
}
else {
New-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name SystemUsesLightTheme - Value 1 - Type Dword - Force;
New-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name AppsUseLightTheme - Value 1 - Type Dword - Force
}
}
Allow scripts to run in powersehell for current user
Set-ExecutionPolicy - Scope CurrentUser remotesigned
Get-ExecutionPolicy - List
revert to original polecies
Set-ExecutionPolicy - Scope CurrentUser Restricted
Measure-Command { .\do_something.ps1 | Out-Default }