I just upgraded my favorite image viewer to IrfanView 3.91, and it came to my attention that since 3.90, Irfanview now has a command-line option to set an image as wallpaper. Since Irfanview can tile or resize the image, as well as automatically converting from any format to bitmap … it seems obvious that since you should already have IrfanView installed (seeing as it’s the fastest image viewer out there for Windows), the best choice for setting wallpapers is to use that.

So, here’s a little script to randomly pick a file and have IrfanView set it as wallpaper. Throw the script into your Scheduled tasks, or your startup folder … and you’re all set [;)]

WallpaperFolder = "C:\Documents\Me\Documents\Pictures\art photos"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.Namespace(WallpaperFolder)
set files = objFolder.Items
randomize
command = """C:\Program Files\IrfanView\i_view32.exe"" """ & files.Item(cint((files.Count - 1) * Rnd)).Path & """ /wall=0 /killmesoftly"
set WshShell = CreateObject("WScript.Shell")
WshShell.Run command, 0, true

Seems like that should do it. Of course, that assumes you have nothing but images in that folder. If you wanted to select only .jpg files from a folder that had other things in it, you could do something like:

WallpaperFolder = "C:\Documents\Me\Documents\Pictures\art photos"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.Namespace(WallpaperFolder)
set files = objFolder.Items
i = cint((files.Count - 1) * Rnd)
while lcase(right(files.Item(i).name,3)) <> "jpg"
i = cint((files.Count - 1) * rnd)
wend
command = """C:\Program Files\IrfanView\i_view32.exe"" """ & files.Item(i).Path & """ /wall=0 /killmesoftly"
set WshShell = CreateObject("WScript.Shell")
WshShell.Run command, 0, true

As a simple note, you can change the /wall=0 to 1 or 2 if you wish:

  • /wall=0 set it as wallpaper (centered)
  • /wall=1 set it as wallpaper (tiled)
  • /wall=2 set it as wallpaper (stretched)

10 Responses to “Better Wallpaper Changer”

Search
Similar Posts
    None Found
Recent Posts
    None Found