1

I was thinking about causing my desktop background to change using a .bat at set times. (i.e. 6:00 AM to 6:00 PM have a background and then from 6:00 PM to 6:00 AM have a different set background)

I thought something along this line would work but I've never programmed specifically just on the dos before so I don't know if it would or not.

IF Time <= 12:00:00.00 THEN
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Users\Pictures\Pic1.jpg" /f
Else
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Users\Pictures\Pic2.jpg" /f

I'm a complete newbie to programming so please explain anything you create. Thank you!

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
  • Leave the part that changes the wallpaper. What will this program do. If current time is <=12:00... Then set x else set y. Is this you want ? Or you want it to be checking continously and automatically changing wallpaers 24x7 ? – Mukul Goel Nov 19 '12 at 22:54

1 Answers1

0

Setup two scheuled tasks in windows to run independant scripts, one for 6am and one for 6pm.

Within the cmd files enter the following lines replacing the path for Image1.bmp with the filename and path of your choice.

reg add “HKEY_CURRENT_USER\Control Panel\Desktop” /v Wallpaper /t REG_SZ /d E:\photos\image1.bmp /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
  • Make sure you use straight quotes there rather than smart quotes. Smart quotes work fine in Powershell, but rather less fine in CMD. :-) – Mark Nov 19 '12 at 23:17
  • Thanks for `RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters` command – anishsane Nov 20 '12 at 09:47
  • If that worked could you mark the question as answered, unless of course the schedule task part isn't what you're looking for? – David Lloyd Brookes Nov 20 '12 at 11:35