3

It seems like I can't fetch the 1.jpg to be my wallpaper in win 8. The wallpaper become pure black after run this. Why I can't fetch the pic?

@ECHO OFF
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "source\1.jpg" /f >nul
rundll32 user32.dll,UpdatePerUserSystemParameters>nul
PAUSE

The result remain the same after I change the path.

@ECHO OFF
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "%~dp0source\1.jpg" /f >nul
rundll32 user32.dll,UpdatePerUserSystemParameters>nul
PAUSE
finkfink
  • 175
  • 3
  • 12

1 Answers1

1

Maybe a sintax problem ?

reg add “HKEY_CURRENT_USER\Control Panel\Desktop” /v Wallpaper /t REG_SZ /d  "F:\ull\Path\To\WallpaperFile" /f
MC ND
  • 69,615
  • 8
  • 84
  • 126
  • Yes. Variables are replaced before executing the line. So, assuming the jpg is in a folder named source under the directory in which the batch file is located, ... it seems ok. – MC ND Oct 30 '13 at 09:37
  • I'm unable to see where lines start or end. Please, edit question to include it. – MC ND Oct 30 '13 at 09:51
  • `reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d "%new%" >nul` – finkfink Oct 30 '13 at 09:57
  • `REG ADD "HKEY_CURRENT_USER\Control Panel\Desktop" /V WallpaperStyle /F /T REG_SZ /D 0 >nul` – finkfink Oct 30 '13 at 09:57
  • In your `set new= ..` you are quoting the string. So, it should not quote the variable in `reg add`. BUT, I've reading msdn forums and from windows Vista this approach to wallpaper changes does not work. Or at least not as intended. The changes to the registry will apply on new logon. The only robust way to get the wallpaper changed instantly is to use the windows api. You can get [here](http://stackoverflow.com/a/9440226/2861476) what you need – MC ND Oct 30 '13 at 11:17