1

I'm currently trying to change the background of my desktop through a script. I'm using Windows 10. Here's my script so far in a batch file :

@echo off
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\Users\James\Downloads\
Wallpapers\Coding_Wallpapers\Wallpaper_08.bmp /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

The file path is definitely right because I pasted it into MS-DOS and it opened the correct image. As others have suggested online, I made sure the picture was a .BMP

Any help would be greatly appreciated.

Devin O'Keefe
  • 21
  • 1
  • 7
  • Normally this task is accomplished using Group Policy. – Bill_Stewart Jun 07 '17 at 18:22
  • In the future I was planning to have the script select the wallpaper based on folder name (i.e. the Coding_Startup.bat file opens up a coding_wallpapers folder) and then change the wallpaper to the next file in the folder every 30 minutes. Does Group Policy definitely have the functionality to do this? As a note, I will also be doing this with 3 other scripts into 3 other wallpaper folders. Thanks – Devin O'Keefe Jun 07 '17 at 18:48
  • Maybe [this](https://stackoverflow.com/a/22344255/2861476) could help. – MC ND Jun 07 '17 at 19:00
  • You might try it with a JPG image or a PNG image. I use JPG images with nearly the exact same code and it works consistently among hundreds of computers. – GrumpyCrouton Jun 07 '17 at 19:46
  • Cool, I'll give a JPG a go – Devin O'Keefe Jun 07 '17 at 21:02
  • @GrumpyCrouton I tried my script with a JPG and the terminal windows outputted "Value Wallpaper exists, overwrite(Yes/No)?". When I type in Yes, a photo viewer opens, showing the wallpaper JPG file, but the desktop background doesn't actually change. Is it normal to get this message? If you know of any possible fixes, they would be greatly appreciated. – Devin O'Keefe Jun 08 '17 at 09:01
  • @DevinO'Keefe Interesting. I'm not really sure why your having that issue. – GrumpyCrouton Jun 08 '17 at 12:49
  • @GrumpyCrouton I guess I'm just going to have to leave this project for another day on another machine. Thanks for your help anyway! – Devin O'Keefe Jun 09 '17 at 13:14

0 Answers0