0

I'm trying to change the wallpaper desktop with this command in .bat:

@echo off
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d c:\images\bella.jpg

but is not working.

The idea is to have a group of images and change the background of the users

  • 1
    See if [this](http://stackoverflow.com/a/22344255/2861476) can help. – MC ND Jan 28 '17 at 16:35
  • Can you please [format your code](http://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks)? – Joe C Jan 28 '17 at 17:10
  • 2
    Possible duplicate of [How to change wallpaper using batch](http://stackoverflow.com/questions/20093278/how-to-change-wallpaper-using-batch) –  Jan 28 '17 at 18:18
  • A quick search reveals a [lot of question with the same topic](http://stackoverflow.com/search?q=[batch-file]+change+wallpaper) –  Jan 28 '17 at 18:20

2 Answers2

0

this works for me:

<!-- : --- Self-Elevating Batch Script ---------------------------
@whoami /groups | find "S-1-16-12288" > nul && goto :admin
set "ELEVATE_CMDLINE=cd /d "%~dp0" & call "%~f0" %*"
cscript //nologo "%~f0?.wsf" //job:Elevate & exit /b

-->
<job id="Elevate"><script language="VBScript">
  Set objShell = CreateObject("Shell.Application")
  Set objWshShell = WScript.CreateObject("WScript.Shell")
  Set objWshProcessEnv = objWshShell.Environment("PROCESS")
  strCommandLine = Trim(objWshProcessEnv("ELEVATE_CMDLINE"))
  objShell.ShellExecute "cmd", "/c " & strCommandLine, "", "runas"
</script></job>
:admin -----------------------------------------------------------

:: administrator commands here
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d  "c:\images\bella.jpg"
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
exit

parts of this code wasn't created by me. this batch script runs all commands after the comment : administrator commands here
as an administrator, and uses this path to find the image: c:\images\bella.jpg
if this script isn't working, verify the path.
i don't think this works on vista.
tested on win 7 and 8.

HackR_360
  • 192
  • 2
  • 9
  • What OS are you using? This code doesn't work on Windows 10 for me. Honestly, I'm skeptical that it's worked on _any_ Windows OS since XP. – SomethingDark Jan 28 '17 at 20:36
0

you can use a small .exe file to do it. ill give you a download link to the exe, there is also a README file in the zip folder that gives you instructions on how to use it.

Download link: https://mega.nz/#!dAxlSZJT!C6JCrXQUVgnFv9Ez0hqRMG1UkcPFHIEJOJYMV1Ezlxw

Virustotal scan: https://www.virustotal.com/en/file/a9b015a25360cd46b4f8a5631d0eef347f564da04b5a99d77172efeb8952925a/analysis/1485629946/