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?
Answer
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.
No comments:
Post a Comment