That's weird, the code didn't post when between the code tags and I was unable to edit/reply to/or delete the original thread.
Option Explicit
Dim WshShell, oFolder, intNumber, strValue, i, oFile, strFolder
strFolder = "C:\Documents and Settings\e1614\My Documents\My Pictures\Wallpapers\"
Set WshShell = WScript.CreateObject("Wscript.Shell")
Set oFolder = WScript.CreateObject("Scripting.FileSystemObject").GetFolder(strFolder)
Do While True
Do While True
Randomize
intNumber = Int((oFolder.Files.Count) * Rnd)
i = 0
For Each oFile In oFolder.Files
If i = intNumber Then Exit For
i = i + 1
Next
If oFile.Name <> strValue Then
strValue = oFile.Name
Exit Do
End If
Loop
Set oFile = Nothing
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", strFolder & strValue
If Left(strValue, 4) = "xkcd" Then
WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle", "0"
Else
WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle", "2"
End If
WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False
WScript.Sleep 600000
Loop
Set WshShell = Nothing
Set oFolder = Nothing