All I'm trying to do is get Windows to switch to a different Wallpaper folder at night (a folder containing night images). To achieve this I'm planning to use Task Scheduler to run .bat files which simply switch the names of the two folders around. That's pretty straight-forward.

The only problem is that Windows won't let me rename the folder containing the current Wallpaper image. This means I have to temporarily change the current wallpaper image to something else while I'm renaming the folders.

And to do this I need some kind of file to modify the registry key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper

I did find a script someone had written which I think does this, but it's too technical for me to understand. I don't know anything about the C language, what classes and namespaces are, or how to create a file that runs this code in Windows. Also, it seems like a lot of code just to change the value of a single registry key. And would I have to install software?

Perhaps someone could give me some help?

Also, could anyone confirm that the Windows wallpaper folder is not kept in the registry? If it was, I could simply change this, and wouldn't have to rename folders. But I've done a lot of searching and can't find any trace of it in the registry.


goto Computer\HKEY_CURRENT_USER\Control Panel\Desktop add new string value named "Wallpaper" and set it's value to the full path of the image.

  • Thank you but I don't believe this helps me to change the wallpaper using Task Scheduler, which is what I'm trying to do. – L J Mar 6 '19 at 13:47

@zebanovich's answer is correct in that HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper is generally the key used to update the Desktop wallpaper.

Windows doesn't have a specific folder for wallpapers. You can set any file path you want in that registry key. Try this batch command:

reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Folder\File.jpg" /f
start "" /b RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters ,1 ,True
start "" /b RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters ,1 ,True
start "" /b RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters ,1 ,True
start "" /b RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters ,1 ,True
start "" /b RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters ,1 ,True

Replace C:\Folder\File.jpg with the full path to the file you want to set the wallpaper to. You can run this directly from the command line to give it a try. If it does what you want, then create one batch file for day and one for night, then add two tasks in the task scheduler to match.

The reason for the repeated RUNDLL32 command is that it seems to only work inconsistently. Repeating it a few times seemed to work for me.

For me it also sometimes stops working altogether. In that case, I had to run taskkill /f /im explorer.exe & explorer.exe to get it working again.

If this answer doesn't work for you, please update your question with more information.

  • Thank you for this, but the script didn't change the wallpaper. I've done some investigating, and I believe the registry key I need to change is HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\WallpaperSource Could you please provide a script which changes this key? – L J Apr 28 '20 at 11:52
  • 1
    @LJ I added some more information that may help you. In general, this seems like a terribly inconsistent thing to do through the command line. The registry key you gave me didn't work at all in my Windows 7, but you can try replacing it in the code above to see if it works for you. – Worthwelle Apr 28 '20 at 16:46
  • Worthwelle, Thank you so much for the additional help. This new script works! Sometimes I have to run it twice, but it works. My problem now is that this script makes the new wallpaper permanent, disabling "slideshow". I am trying to change to a new folder but keep slideshow running. I don't suppose you have a script that can change the location of the slideshow folder? – L J May 1 '20 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.