Although dark mode is not as directly supported in Windows Server versions as in Windows 10 or 11 and 12. However, there are some ways to achieve this by changing registry entries. Here is a general guide on how to enable or disable dark mode on a Windows Server using a batch file by changing the registry:
1.) The batch file Dark Mode On and Off Switch for Windows Server!
Create an empty Dark Mode Switch.bat on the desktop and use the following script, just create with copy / paste!
Dark-Mode-Switch.bat
set KEY_NAME="HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
echo query is dark or not
FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY %KEY_NAME% /v AppsUseLightTheme`) DO (
set is_dark=%%A %%B
)
echo activate if yes and vice versa
if %is_dark% EQU 0x1 (
reg add %KEY_NAME% /v AppsUseLightTheme /t REG_DWORD /d 0 /f
) else (
reg add %KEY_NAME% /v AppsUseLightTheme /t REG_DWORD /d 1 /f
)
echo %is_dark%
echo pause can be removed (waiting for keypress) pause
pause
If you run the Dark Mode Switch.bat, it will be deactivated when Dark Mode is active and vice versa, quite practical if you have a great need to constantly change the mode. Or to test your software in different modes!
2.) What should you keep in mind when creating the Dark Mode On/Off Switch batch file for Windows Server?
When creating a batch file for the Dark Mode Switch in Windows Server versions (2025, 2022, 2019), there are a few important points to keep in mind:
1. Check compatibility
Make sure that the registry paths and values you want to change are valid in the specific Windows Server version. These may change in future versions such as Windows Server 2025.
2. Run the batch file with administrator rights
Changes to the registry require administrator rights. Make sure you run the batch file as an administrator to avoid permission issues.
3. Back up the registry
Before making changes to the registry, it is advisable to back up the registry. This can be done by exporting the affected registry keys. To do this:
- Open the registry editor (regedit).
- Navigate to the affected keys.
- Choose File > Export to create a backup.
4. Test the batch file
Test the batch file in a test environment or on a non-critical server to make sure it works as intended without affecting other settings.
5. Impact and reboot
Changes to the registry may not be immediately visible. You may need to log off or restart the server for the changes to take effect.
6. Security and script distribution
Make sure the batch file comes from a safe source and does not contain malicious commands. Avoid distributing batch files through unsafe channels.
7. System compatibility
The registry entries shown above are intended for modern Windows versions, but they may not work in all Windows Server versions such as Windows Server 2019 and 2022 or future versions (such as Windows Server 2025). Check Microsoft's documentation for the most up-to-date information on supported features and registry entries.
More sample batch file!
Here is an example of what a batch file might look like to switch between dark and light mode:
@echo off
SETLOCAL ENABLEEXTENSIONS
:: Select "1" for light mode or "0" for dark mode
SET MODE=0
IF "%MODE%"=="0" (
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
echo Dark Mode activated.) ELSE (
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 1 /f
echo Light Mode activated.)
ENDLOCAL
Step-by-step instructions
1. Create:
Open Notepad and paste the above code. Save the file as DarkModeSwitcher.bat.
2. Run:
Right-click on the batch file and select "Run as administrator".
3. Test:
After running the batch file, check if the mode was switched as desired.
By following these points, you can ensure that your batch file works effectively and minimize potential problems.
PowerShell is a powerful Windows Server management tool that allows administrators to efficiently automate and script tasks. Here are some handy PowerShell
Here is the correct guide to enable WebP support in Windows File Explorer for Windows Server 2025, 2022 and 2019: 1. WebP Preview for Windows Server File
Error code 0x80073712 indicates that the component store also known as the Component Store or WinSxS on your Windows server is corrupted. This store contains
If the Install-WindowsFeature -Name Wireless Networking command does not work on a Windows server, there are several possible causes and resolution steps
The standard evaluation period for Windows Server including the DataCenter version is 180 days. However, there is an option to extend this trial period
Yes, it is possible to convert the Windows Server 2022, 2019, etc. Datacenter evaluation version into a fully licensed version of Windows Server Datacenter.
This website does not store personal data. However, third-party providers are used to display ads, which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF). The CMP ID is 300 and can be individually customized at the bottom of the page. more Infos & Privacy Policy ....