Question

How can I set desktop background color via .bat file?

Asked by: maconithappen

I currently have a .bat file, and it's loading a custom graphic image.  This is great.  But now, I need to be able to have the background color set too so it isn't the default blue.  (I need it to be black).

Any help would be greatly appreciated.  I did search and google but haven't as of yet found a proper solution.  

I used the bottom 2nd to last answer here for the background.
http://www.tomshardware.com/forum/35321-45-file-change-desktop-wallpaper

Now I need to be able to set the color.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-28 at 10:48:41ID24690601
Tags

bat desktop

Topic

Microsoft Windows Operating Systems

Participating Experts
2
Points
500
Comments
10

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Colors...
    Hi, I have a question about colors in Java. There are only like about 13 colors defined inside the Color class (java.awt package). I want to have continuous colors like.... white....gray....black contineously...that is its like a slider in swing... where you move the slide...
  2. Color
    How do i change the color of text in c++?
  3. color
    i have a canon 4100 ink jet printer. when i use my scanner epson 636u and adobe photo deluxe or ulead photo impact i can't print out the richness of the colors i see on the screen.. the exact colors are there but always washed out and lighter than what i see on the screen. i...
  4. Colors...
    Good Day. CSS not being my strong suit I'm sure I must be missing something fairly easy here, so points to help me out ;p I've got a page with some links that I want to be either black or blue, regardless of whether they've been visited or not. I don't want to muck around w...
  5. the color of files....
    Hello Experts, I am in redhat .... I guess 9.x ?! For some reason, the setting makes different kinds of files having different colors. The *.tex file is yellow .... so light that I can barely see it ! How do I change the colors of those files (I mean the file name when ...
  6. Coloring Black & white photos
    Hi friends, I have many Black & white photos that I need a software to color it or in specefic retrieve their original colors.. like skin color, tree color , different hair & eyes colors ..etc..., I can see in the photos that there are lot of degrees in the black co...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: oBdAPosted on 2009-08-28 at 11:03:02ID: 25210108

If you're talking about the script at the bottom of the page, just add the line
REG ADD "HKCU\Control Panel\Colors" /V "Background" /T REG_SZ /D "0 0 0" /F
somewhere before the rundll32 commands.
And you might want to replace all references to "C:\Documents and Settings\%USERNAME%" with "%UserProfile%"; the former is incorrect.

 

by: maconithappenPosted on 2009-08-28 at 12:54:27ID: 25211104

:/

I tried what you suggested and it didn't seem to work.  Also, I tried using the %UserProfile% and that didn't work either, I had to go back to my %USERNAME% in order to make my old stuff work.

The cheesy workaround I did, is what my boss suggested, which is simply make the image HUGE.  This works, but results in a very large image size.

Any further help would be great. :)

 

by: BillDLPosted on 2009-08-29 at 00:51:02ID: 25213288

The easiest way to do this is by using Windows "Themes".  This is installed in XP by default, and creates a file association with the *.theme file type in the registry.  Files with the *.theme extension will open on a double-click straight to the Desktop Properties "Themes" tab.

The command that is run is:

%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:"Filename.theme"

where "Filename.theme" is the file containing the settings.  A *.theme file is just a text-based file with section headers like an *.ini file.  It's file to edit in Notepad, but there is no need to, because whenever you change something away from whatever "theme" you currently have set, it then allows you to do a "Save As" from the "Themes" tab without actually applying the changed settings at that time.

Let me show you with screenshots.  I just use the "Windows Classic" theme because I find the big pastel-shaded borders of the "Windows XP" theme a bit too much like a child's nursery and toys.

All I did was open the Desktop Properties to the "Desktop" tab, and change the background colour to a sickly shade of green.  I DID NOT click the "Apply" button, but instead went to the "Themes" tab and you will see that it now showed the current theme as "Windows Classic (modified)".  From there you can just do a "Save As" and choose a destination and file name for your *.theme file.

The default location for *.theme files is the:
C:\WINDOWS\Resources\Themes
folder, and you would there find "Windows Classic.theme" and "Luna.theme".

If you saved your new custom *.theme file to that folder, then it would be available in the drop-down "Theme" list under the Desktop Properties > Themes tab for selection.  That, however, is not the purpose of this particular suggestion.

Double-clicking on your modified *.theme file would open Desktop properties to the new Theme and allow you to click the "Apply" button and make an immediate change to the desktop.

The drawback with writing values to the registry is that this type of change is not applied until the user logs off and back on again.  Even refreshing the desktop, or killing and restarting explorer.exe does not apply the change after changing registry values.  Of course, you could add a command to log the current user out, or restart the system, or whatever, but that's not the best method really.

 

by: BillDLPosted on 2009-08-29 at 00:53:10ID: 25213295

Damn, I pressed a key somewhere that acted as the "Enter" button while I was trying to insert a paragraph at the top of my comment, which was going to be:

If you just want the Desktop to be black, then you don't need to use a Wallpaper image.  You can just set the Desktop Color.

I hadn't finished my comment either.  It will continue in the next comment.

 

by: BillDLPosted on 2009-08-29 at 01:30:16ID: 25213346

Incidentally, if you DID choose just to use an image as "wallpaper", then you would just need a tiny black rectangle and you would set it to "stretched" to cover the screen area.

OK, so to continue where I left off about "Themes".

You have a suitably named *.theme file.  I have attached my "Classic_Black.theme" file as a *.txt file, so you can see the contents.  It will have MY chosen settings that relate to all the other Desktop "Scheme" I prefer.  A "Scheme" isn't really a "Theme".  Scheme refers to an overall colour and appearance scheme that is presented in the "Appearance" tab of Desktop Properties as preconfigured schemes for Windows and Buttons, Color Scheme, and Font Size.  These "scheme" settings are stored in the various sub-keys of:
HKEY_CURRENT_USER\Control Panel\Appearance
and the [Default] String Value in the key:
HKEY_CURRENT_USER\Control Panel\Current
defines your current Color Scheme.

But we're not really talking about the "Appearance" tab here.  Presumably your boss just wants all his Toolbar, Font Size, etc just left as it is and simply wants a new Desktop background colour.   So, if you just change the Desktop Color under the "Desktop" tab, then export a *.theme file from the Themes tab, it will have all the "Scheme" settings in the file as well as the changed Desktop colour.

An abbreviated command you can run to open a *.theme file is:

control desk.cpl desk,@Themes /Action:OpenTheme /file:"C:\Path_To\Classic_Black.theme"

I am trying to find out if there is an action to apply settings, something like  /Action:SetTheme  rather than  /Action:OpenTheme.

You could easily compile an *.exe that opens the theme file and clicks the Apply button by installing AutoIT3:
http://www.autoitscript.com/autoit3/

 

by: BillDLPosted on 2009-08-29 at 01:38:11ID: 25213359

Forgot the *.theme file renamed as a *.txt file, didn't I.

  • Classic-Black.txt
    • 5 KB

    My example *.theme file renamed as a *.txt file. Settings are all Windows Standard and Windows Classic, except for the Desktop colour, which is black.

 

by: BillDLPosted on 2009-08-29 at 02:54:17ID: 25213528

OK, if someone can fix my attempt at a *.vbs script so it gets past the path to the *.theme file, then this would be a better way.  See code snippet.  The error is at the   "C   part on this line:
/File:"C:\WINDOWS\Resources\Themes\Classic_Black.theme""

Someone else seems to have a fully functional script here:
http://blogs.msdn.com/alejacma/archive/2008/11/26/how-to-change-windows-theme-programmatically-in-xp.aspx
but I haven't tested that.

' ChangeTheme.vbs
' Usage wscript changetheme.vbs
 
' Create the program environment 
Set WshShell = WScript.CreateObject("WScript.Shell")
 
' Load named .theme file into Themes tab of Desktop Properties
WshShell.Run "rundll32.exe Shell32.dll,Control_RunDLL desk.cpl desk,@Themes /Action:OpenTheme /File:"C:\WINDOWS\Resources\Themes\Classic_Black.theme""
 
' Pause for 2 seconds, ie. 2000 milliseconds for it to load
Wscript.Sleep 2000
 
' Make sure Desktop Properties dialog stays in focus
' to receive the keystrokes to be sent to it.
WshShell.AppActivate("Desktop Properties")
 
' Click the Apply button using Alt and A keys
WshShell.Sendkeys "%{A}"
 
' Pause for 7 seconds for the changes to be applied behind the dialog
Wscript.Sleep 7000
 
' Make sure Desktop Properties dialog stays in focus
' to receive the keystrokes to be sent to it.
WshShell.AppActivate("Desktop Properties")
 
' Click the OK button, which is the same as Enter, to close dialog
WshShell.Sendkeys "{ENTER}"

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

Select allOpen in new window

 

by: BillDLPosted on 2009-08-29 at 02:59:58ID: 25213549

Yeah, that other guy's script works fine on my XP SP3 system.  Just set the path to your *.theme file near the top of the script.

 

by: BillDLPosted on 2009-08-29 at 03:18:59ID: 25213611

Hmmm.  An unfortunate side effect is that it seems to return the user's Sound Scheme to the standard Windows XP (noisy) scheme.  Even when I opened the *.theme file in Notepad and set all the sound events at the bottom of the file to:
DefaultValue=
when I applied that theme using the script, it populated a number of those lines again with the paths to the *.wav files in a way that certainly looks like the default XP sound scheme.

Ask another question how to programmatically apply a saved sound scheme ;-)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...