Is it possible to set a desktop background using batch? Meaning have a batch file open on start-up and then change the background to a jpeg of my choice? For example, my school's pcs are not set to retain the background after log-off. I always have to set my UNIX background every time I boot up, as does everyone else. I think it would be a nice feature to have a batch script move itself to /startup and then start and change the background.

Recommended Answers

All 4 Replies

go here:

they show how to hack the registry to change the background. Be wary of that hack, because I believe it might actually be in: HKEY USERS\ .DEFAULT\Control Panel\Desktop

just remember hacking the registry can result in very bad things happening!

Now just create a simple registry hack ie: background.reg
and place it in the startup folder, you might have to right click the desktop and click refresh for the change to happen

I don't have access to the registry either. Using the command prompt I can get to the start-up folder, but not by My Computer.

I also shouldn't be able to access the command prompt, but I made a batch script like below, which allows me to open the application.


I know this thread is very old, but it appears no one out there has made this work effectively. I managed to do so today by using the following. Hopefully this helps someone that stumbles upon this on Google:

:: Written by Eric Husband
:: 7/10/2009
:: copies the wallpaper from a location into the proper directory and as the proper file name. DO NOT CHANGE THE DESTINATION FILE NAME.
copy "\\ehusband-x1\ERIC\wallpaper1.bmp" "C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Microsoft\wallpaper1.bmp"
:: Adds the necessary Registry values, in case this person is using a System Wallpaper. If they've already customized their wallpaper, the following lines are not necessary. They won't hurt though.
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Microsoft\wallpaper1.bmp"
:: Change the last number in the following line to a 0 if you want to center the bitmap on the desktop. Change the last number in the following line to a 2 if you want to stretch the bitmap vertically and horizontally to fit the desktop.
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 2
:: Change the last number in the following line to a 0 to not tile the image; setting it to a 1 Tiles it.
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 0
:: The following line refreshes the desktop.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
:: The following line Locks the workstation.
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, LockWorkStation

This should work in batch.

@echo off
call :quiet>nul 2>&1
goto :EOF
:: Configure Wallpaper
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "%SystemRoot%\energybliss.bmp"
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 2
:: Make the changes effective immediately
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

Modify the script to your needs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.