This guide will help you set up two scripts to switch themes on Windows: one to activate the light theme at 7 AM and another to activate the dark theme at 9 PM.
Table of contents
Open Table of contents
Step 1: Create PowerShell Scripts
Create two PowerShell script files: Set-LightTheme.ps1
and Set-DarkTheme.ps1
.
1.1 Set-LightTheme.ps1
# Set-LightTheme.ps1
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1 -Type Dword -Force
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1 -Type Dword -Force
1.2 Set-DarkTheme.ps1
# Set-DarkTheme.ps1
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 -Type Dword -Force
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0 -Type Dword -Force
Step 2: Schedule the Scripts with Task Scheduler
2.1 Open Task Scheduler
- Press
Win + S
and type “Task Scheduler”. - Click on Task Scheduler to open it.
2.2 Create a New Task
- In the Actions panel, click on
Create Basic Task
.
2.3 Name the Task
- Name: “Set Light Theme”
- Description: “Activates Light Desktop Theme At A Certain Time”
2.4 Set the Trigger
- Select
Daily
and clickNext
. - Set the start time to 7:00 AM and click
Next
.
2.5 Start a Program
- Select
Start a program
and click Next.
2.6 Program/Script
- Program/script:
powershell.exe
- Add arguments (optional):
-ExecutionPolicy Bypass -File "C:\Path\To\Set-LightTheme.ps1"
- Apply the following parameters in
Settings
tab:
![Parameters settings](path/to/parameters-settings.png)
2.7 Click Finish
to create the task
2.8 Repeat for Dark Theme
Repeat the above steps to create a task for the dark theme, but with the following changes:
- Name: “Set Dark Theme”
- Description: “Activates dark theme at 9 PM.”
- Start time: 9:00 PM
- Add arguments (optional): “-ExecutionPolicy Bypass -File “C:\Path\To\Set-DarkTheme.ps1”`
Step 3: Verify the Tasks
- Go to the Task Scheduler Library.
- Verify that both tasks (Set Light Theme and Set Dark Theme) are listed and scheduled correctly.
Notes
- Make sure the script files are in a location accessible by Task Scheduler.
- You can test the scripts by running them manually to ensure they change the theme as expected.