Changing the desktop background image in Windows is perhaps the first thing we all learn as kids. We all set the wallpaper to cartoon characters or TV show personalities. I used to have Selena Gomez as my desktop background when in high school. Back then you had to go into Windows settings and change the wallpaper from there. Now in Windows 10, you can right-click on any image file and set it as desktop background through the right-click context menu.
However, if you want to change the desktop background through a command line interface tool then you can depend on “Refresh Wallpaper”. It is an old tool but still works fine in Windows 10. You can give the command “RefreshWallpaper.exe /?” in order to see the usage and some basic information about it.
Typically, you will give the command “RefreshWallpaper.exe [imagefile]” where [imagefile] is the full path and file name of the image file. If you omit the path of the file, then it fails to work. If the path contains space, then you should enclose the full pathname inside double-quotes. For example, if you want to set D:\Image\wall.jpeg as the desktop background then you can give the command “RefreshWallpaper.exe D:\image\wall.jpeg”. It does not display any message even when it fails to set the wallpaper.
You can use this to randomize wallpapers using a simple batch script. You can use the following batch script and save it in form of a batch script file (for example, change.bat) in the same folder as RefreshWallpaper.exe.
@echo off setlocal EnableDelayedExpansion REM Set wallpaper directory set "p=D:\wall\" set "curdir=%CD%" cd /d %p% set n=0 for %%f in (*.jpg) do ( set /A n+=1 set "file[!n!]=%%f" ) cd /d %curdir% set /A "rand=(n*%random%)/32768+1" echo Setting wallpaper to %p%!file[%rand%]! RefreshWallpaper.exe %p%!file[%rand%]!
The only thing that you have to change here is the wallpaper directory that is set as D:\wall\ in the batch script above. After you run this batch script, it will automatically choose a random JPG image file from that folder and set it as the desktop background. You can make this batch file to be auto-run at Windows startup to make it change the wallpaper to a random image each time you start your Windows PC.
Conclusion: Refresh Wallpaper is a simple command line tool to quickly change the desktop background in Windows. It works on all versions of Windows and supports all the image file types. It can be used for changing the Windows wallpaper through a batch script or for randomizing the wallpapers.
You can download Refresh Wallpaper from https://www.cherubicsoft.com/projects/refreshwallpaper.