Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Wallpaper with a batch file, on program close. Possible? [closed]

I'm trying to create a batch file that will change my background when a program closes on Windows 7. I've tried using this, but it doesn't work, even when I log off and log back in:

@echo off
reg /add HKCU\Control Panel\Desktop\WallPaper /v wallpaper /t REG_SZ /d c:\images\wallpaper.bmp
like image 229
sagev9000 Avatar asked Oct 15 '11 17:10

sagev9000


1 Answers

There are some errors in your command:

  1. You have added unnecessarry / to add command.
  2. You don't enclose registry key name in quotes (for space escape).
  3. You have specified wrong path (extra WallPaper at the end).

This should do the trick:

reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d c:\images\wallpaper.bmp

Of course, if the wallpaper path contains spaces you must enclose it in quotes too.

I also added key /f to force overwriting if wallpaper is already set.

like image 133
refaim Avatar answered Sep 19 '22 13:09

refaim