WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: pguild on November 16, 2022, 04:29:49 PM

Title: How change walllpaper with Winbatch coding?
Post by: pguild on November 16, 2022, 04:29:49 PM
The wallpaper function no longer works, at least not for .jpg files. Is there a way to change wallpaper with Windows 10 or Windows 11?

I can easily change wallpaper manually, i just right click on an image and click Set as Background Image

But I want to programmatically change the wallpaper, say, every day or as a slideshow in yesteryear.
Title: Re: How change walllpaper with Winbatch coding?
Post by: stanl on November 17, 2022, 03:40:33 AM
Found this as a batch process. If it works for you could be called from a WB script. Has to be run as administrator.


takeown /f c:\windows\WEB\wallpaper\Windows\img0.jpg
icacls c:\windows\WEB\wallpaper\Windows\img0.jpg /reset
copy %~dp0img0.jpg c:\windows\WEB\wallpaper\Windows\img0.jpg
copy %~dp04k\*.* C:\Windows\Web\4K\Wallpaper\Windows
Title: Re: How change walllpaper with Winbatch coding?
Post by: td on November 17, 2022, 06:47:04 AM
Or you could just use the WinBatch WallPaper function:

https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WILLZ_W__002.htm (https://docs.winbatch.com/mergedProjects/WindowsInterfaceLanguage/html/WILLZ_W__002.htm)
Title: Re: How change walllpaper with Winbatch coding?
Post by: pguild on November 17, 2022, 08:35:29 AM
In my post I said that the WALLPAPER function in Winbatch does not work for me.
All my desired images for wallpaper are in jpg format not in bmp format.
It seems that the bmp format is required when using the WALLPAPER function.
When I use .jpg images with WALLPAPER, all I get is a nice black screen. 

I can easily manually use a .jpg image for wallpaper  if I simply right click on
the image and press b (for set as background).

Is there a workaround to automate a wallpaper change using Winbatch when using .jpg format?
Title: Re: How change walllpaper with Winbatch coding?
Post by: pguild on November 17, 2022, 08:54:49 AM
Thanks,stani, for this batch process. I don't know how to use it for my purpose. My goal is to automatically and randomly pick from a list of .jpg images and change the wallpaper to something new everyday. The same way that an iPhone can change its wallpaper.

I can automate the manual process by going to a desired folder with .jpg images and moving the cursor over an image and right clicking and using sendkey to send "b" for set as background. But making sure I am clicking on an image is a challenge.  Any ideas? I appreciate you. Thanks!

Quote from: stanl on November 17, 2022, 03:40:33 AM
Found this as a batch process. If it works for you could be called from a WB script. Has to be run as administrator.


takeown /f c:\windows\WEB\wallpaper\Windows\img0.jpg
icacls c:\windows\WEB\wallpaper\Windows\img0.jpg /reset
copy %~dp0img0.jpg c:\windows\WEB\wallpaper\Windows\img0.jpg
copy %~dp04k\*.* C:\Windows\Web\4K\Wallpaper\Windows

Title: Re: How change walllpaper with Winbatch coding?
Post by: td on November 17, 2022, 01:11:14 PM
Quote from: pguild on November 17, 2022, 08:35:29 AM
In my post I said that the WALLPAPER function in Winbatch does not work for me.
All my desired images for wallpaper are in jpg format not in bmp format.
It seems that the bmp format is required when using the WALLPAPER function.
When I use .jpg images with WALLPAPER, all I get is a nice black screen. 

I can easily manually use a .jpg image for wallpaper  if I simply right click on
the image and press b (for set as background).

Is there a workaround to automate a wallpaper change using Winbatch when using .jpg format?

The WallPaper function works with jpeg files on Windows 10/11. It has been tested with jpeg files on those platforms. It does require running the script/exe as an elevated admin just like the batch file does. If you do not execute the script as an elevated admin, you will likely just get a black desktop or something similar.
Title: Re: How change walllpaper with Winbatch coding?
Post by: pguild on December 14, 2022, 01:24:51 PM
How do I run a script or .exe in admin/elevated mode?