Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to discover a way to use a script (batch file commands) to set a .jpg image as the wallpaper for a new user account. If this can't work, then I could use a logon script for that user, once the account is created and the user logs on.

Please don't give me advice on how to set a bitmap wallpaper. There is a registry key that can be set in Default User or Current User (HKCU) to assign a .bmp as the wallpaper and this setting takes effect immediately and reliably.

What I can't figure out how to do is set a .jpg and force Windows XP to refresh the desktop and display the new wallpaper. I can set the registry keys just fine for Default User and Current User and if I open the Display control panel to the Desktop tab, I can click OK and the wallpaper will change.

What is the trick to command Windows to do this from the command line? I'll accept a rundll32.exe (but the ones I've tried don't work) or a utility or applet that can run in a script, but I can't just pop open the Display control panel to the Desktop tab and make the user do it themselves. I could even accept an applet that converts .jpg to .bmp and sets the bitmap wallpaper registry key. How do you do it?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I've used WallpaperChanger in some of my scripts before. It is a command line utility for changing the wallpaper and it requires the .NET Framework v2.0 or later. It can accept most standard picture types as input files and it will automatically convert them to bitmap format for you before setting it.

The program takes two arguments: the file (including path) to use as wallpaper, and the style (Tiled, Centered, Stretched)

Syntax is: [file] [style]

[file] is the complete path to the file
[style] is an integer (if no style is specified it defaults to Stretched):
0 for Tiled
1 for Centered
2 for Stretched

The file type can be any of the standard picture types (bmp, jpg, gif, etc.). The program will automatically convert the file to a bmp file (required by windows) and place it within the users temp directory.

If the .NET framework isn't an option for you, Command Line Wallpaper Changer Portable works similar to WallpaperChanger, but as a native Win32 application:

Command Line Wallpaper Changer Portable is a small and fast tool to set your windows desktop wallpaper. Simply drag 'n' drop a JPG or BMP image file on CLWCP and it will be set as your new wallpaper.

You can also use the command line to set a new wallpaper. This way, you can even define, whether you want it to be tiled, stretched or centered: Start clwcp.exe with the filename of your desired wallpaper as first parameter, e.g. "1.bmp" or "1.jpg", followed by the optional parameter defining the alignment: "stretch", "tile" or "center". A JPG will be converted to BMP and saved as clwcp.bmp in your Windows folder, then this file is set as new wallpaper.

Both utilities are freeware.

share|improve this answer
    
Thank you for the useful answer and pardon my delay due to excessive holiday activities. A command line tool that takes a .jpg and produces a .bmp is perfect for my needs. I just wonder why the equivalent functionality isn't available through a .dll function. Happy Holidays! –  kwe Dec 22 '09 at 18:41
    
You're welcome, you too! –  John T Dec 22 '09 at 19:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.