Please note, that unsplash has made an app that let users download wallpapers directly off of their website. So this tutorial isn’t really useful any more unless you don’t want to install the app.
I started using bash on windows (WSL) on my windows 10 PC, a while ago, but so far hasn’t found any real use for it in my work scenario, but that changed when I got the idea to write a script that downloads wallpapers from a remote site to my computer every 2 hours (an interval that I chose). It uses linux and windows together to achieve its goal, and its just beautiful what Microsoft did by adding Ubuntu to run natively on Windows 10.
Let me introduce a website with gorgeous photographs that serves as an amazing source of wallpapers, www.unsplash.com. Now what’s so amazing about this website? Well at source.unsplash.com you can get a get a single link to download different photographs every time you load it, and that is essential to creating a periodic downloader for wallpapers for your PC.
Let’s get started, shall we!
- Create a folder anywhere you want your wallpapers to be downloaded to. (Mine was a folder called wallpaper in the picture library). All the script files will be saved in this folder.
- [OPTIONAL] Go to https://source.unsplash.com/ and get the link that suits your need the best. You can get a link that downloads wallpaper for your screen resolution, or with different categories etc.
- Open notepad, or your favorite text editor
- Copy and paste the following code in there (if you have your own unique link for wallpapers, replace the link in the code with your own link)
bash -c "wget -O "download.jpg" "https://source.unsplash.com/category/nature/1920x1080?""
set /p name=<filevar.txt
ren download.jpg wallpaper_%name%.jpg
set /A name+=1
>filevar.txt echo %name%
- Save it as download.bat (Make sure you select “All files” in Save type as, when saving the file)
- Close this notepad and open a new one, and copy and paste the following code in there (this script makes the bat file run without opening a command prompt console window):
Set oShell = CreateObject ("Wscript.Shell")
strArgs = "cmd /c download.bat"
oShell.Run strArgs, 0, false
- Save it as run.vbs
- Open another notepad and type 1 in there and save as filevar.txt
- [OPTIONAL] Test the script by double clicking the run.vbs file. You won’t see anything pop up, but a photo will be downloaded as download.jpg in the folder, if you are connected to the internet, and renamed to wallpaper1.jpg
- Open Task Scheduler (If you don’t know how, press WindowsKey+R and then enter this without quotes “%SystemRoot%\system32\taskschd.msc” and hit enter)
- Create a new task
- In the general tab, set configure for: Windows 10
- In Trigger tab, add new and on Begin the task: At log on, check Delay task for: 30 Minutes (so that it doesn’t start with boot and increase the boot time), check repeat task and enter your time interval at which you want the wallpapers to be downloaded. I have mine set at 2 hours for a duration of indefinitely. Then made sure Enabled is checked and hit okay.
- In the Actions tab, create new and set Action to Start a program.
- In the Program/Script write %systemroot%\system32\wscript.exe or C:\Windows\System32\wscript.exe if you have windows installed in C drive and in the add arguments write //Nologo and then put a space and then the path to your run.vbs file. (To get the path of your run.vbs file, hold shift on your keyboard and right click on it. Then click copy as path from the context menu.) And in the start in, put the path to your folder where you are downloading the wallpapers. (You can simply paste the path of run.vbs and then remove the \run.vbs and the quotes from the box.)
- [OPTIONAL] In condition tab, uncheck Start the task only if the computer is on AC power.
- In the settings tab, Check Allow task to be run on demand. Check Stop the task if it runs longer than and input a value of 2 minutes if you have relatively fast internet or 10 minutes if you have a slow one. And in the drop down box, select stop the existing instance. Press okay and you are done.
Ta-da now you have an automatic wallpaper downloader set to run in the background, all you have to do now is set that folder as your windows wallpaper slideshow folder, from the personalize setting.
Have a great day!