View Full Version : Change a desktop background using Batch?

12-04-2008, 04:56 PM
I already browsed google and I don't think I had any luck.
Is it possible to change a desktop background using a batch file?
If so can somebody please write the code, I really appreciate it.

I already tried this one:

reg /add HKCU\Control Panel\Desktop\WallPaper /v wallpaper /t REG_SZ /d D:\mysetts\image.png

but it ends up saying:

Error: Bad Operation. :confused:

12-04-2008, 06:34 PM
Damn, just realized you have tried what I suggested.
Are you sure you have the path correct?


Is this where your image is?

12-04-2008, 07:12 PM
Do you have permissions on the computer to change the background?

12-05-2008, 01:01 PM
Yeah, the image location is correct.
But I'm not sure with the permissions to change the background,
how can I tell if I'm permitted? O.o;

12-05-2008, 07:16 PM
If you right click on the desktop and go to the properties, can you manually set the background there?

12-06-2008, 04:50 AM
Yeah, though I'm interested on how to do it using batch...

12-06-2008, 09:10 AM
Yeah, though I'm interested on how to do it using batch...

He means you need to do that to see if you have the permissions to change the background.

If your doing it via the registry, wouldn't it be pointless for the batch? Because you would have to restart for it to take effect.

12-06-2008, 12:16 PM
Oh, okay, nvm then.
Thanks anyways.^^
I guess you can close this thread now^^

12-06-2008, 12:49 PM
@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

Try modifying this to suit your needs.
As I said, when changing things via the registry, you usually have to log off and back on again for the changes to take affect. However this piece of code makes the changes immedietely:

%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters