6

Is there a command line option to change the Windows desktop background color?

I want to set my desktop background to use Solid Colors (blue - rgb: 57, 109, 166) with no background image. The only reading I find is about how to change the desktop wallpaper image.

4
  • Not a solution, but a workaround (that's why I won't post it as an answer): you could copy the new background image over the old one (the image should be in %appdata%\Microsoft\Windows\Themes, not sure) and because there is no way to signal Explorer process that the background should be refreshed/reloaded, you'll have to use taskkill command. Not the perfect solution ofcourse. Dec 10, 2014 at 19:18
  • Part of my problem is that I'm not using a background image. The background is being set to "Solid Colors" and I'm using the classic Windows blue background color. Every solution I've found so far shows how to change the background image but not the desktop color. Dec 10, 2014 at 22:12
  • That's the tricky part, you would have to generate an image which is filled with RGB values. Dec 11, 2014 at 12:42
  • Should this be a duplicate of superuser.com/questions/1007379 ? it's slightly different setting to a single file rather than slideshow, but there's overlap Oct 25 at 10:19

3 Answers 3

7

The background is stored in the registry. There are a few different ways to set it. But there several ways to set a registry value via the command line.

To set the background to a specific color you need to unset any wallpaers, and set the color.

HKEY_CURRENT_USER\Control Panel\Colors\Background = 'r g b'
HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper = ''
1
  • Holy cow I think that might be it! I just didn't realize what background was specifying. I figured it was related to the image somehow. I'll give it a shot tomorrow if I can but I'm pretty sure that's exactly it! Dec 10, 2014 at 22:20
4

If you want to make it Automatic, such as with a login script or a batch file, you may use the following:

ECHO Clearing Background ...
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v WallPaper /t REG_SZ /d " " /f
reg add "HKEY_CURRENT_USER\Control Panel\Colors" /v Background /t REG_SZ /d "0 0 0" /f
4
  • Note that you need to run RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters to apply the changes Jun 21, 2019 at 13:23
  • @TomášHübelbauer What do you mean? I tried doing that, but there are no changes. I was expecting an instant change, but perhaps that's not what you meant. Or can it be a permission issue? need to run in admin shell?
    – not2qubit
    Jan 9, 2020 at 19:25
  • Actually I've since found that this doesn't work reliably all the time. I am still figuring out why. Try issuing it multiple times. Maybe the registry is somehow cached? Jan 9, 2020 at 19:38
  • 1
    @TomášHübelbauer Funny enough, I had forgotten that I made a very similar question a long time ago, here. I just updated that post with a link to a solution that seem very related to yours. maybe that can help you understand why the above suggestion fails. PS. the registry is definitely cached, otherwise we wouldn't have to reload it.
    – not2qubit
    Jan 9, 2020 at 20:06
0

I do not think this is an option, but you can easily change the background color by right clicking the desktop, choosing "Personalization", choosing "Desktop Background", and choosing "solid colors". Alternatively, you can make a 1px x 1px image of the color you want, and set as a tiled background image.

1
  • 3
    I'm trying to avoid manual setup because unfortunately it's one of many steps I'm trying to automate through a script on a boat load of systems. It is easy to do manually but it's one more step. Dec 10, 2014 at 22:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .