Set Windows wallpaper from the command line02 Jun 2010
Each year the organisation I work for holds a conference and my team provides technical support. This year is slightly different in that we’ll be using the venue’s ICT equipment rather than our own. Whilst this has many advantages in terms of simplifying things it has thrown up a little issue around something we normally do with the desktop background.
A useful piece of preparation we normally put in place is to set the Windows wallpaper for the desktop background to an image with contact details on it for tech support. This is normally set-up prior to the first day and then if people have a problem they can quickly get the contact information they need.
The problem this year is that the venue have taken a perfectly sensible option of having each machine reset to a standard image when rebooted - presumably using Windows Steady State. So each dcay each machine will need the background image set on it as well as the presentations copying to it.
It is simple enough to automate the copying of presentation files from a USB flash drive but I wasn’t aware of any way to set the background automatically. To remedy this I created a command line executable to do this.
Written in VB.NET the executable takes the file path of the background image file as a parameter. The image must be a bitmap (BMP). If the image file path is excluded then the background image is set to “none”. This executable has been tested on Windows XP SP3 but may also work on other flavours of Windows and is used at your own risk.
The following DOS batch file illustrates how to use the file.
@echo off rem This .BAT file is run from the same folder as the setwallpaper.exe echo Set the background image to a bitmap from the Windows system32 folder setwallpaper.exe "C:\windows\system32\setup.bmp" pause echo. echo Clear the background wallpaper setwallpaper.exe pause