Skip navigation

JSI Tip 10631. How can I alter my desktop wallpaper with a script?

I have scripted Wallpaper.vbs to allow you to switch your wallpaper with a script.

The syntax for using Wallpaper.vbs is:

CSCRIPT //NOLOGO C:\Folder\Wallpaper.vbs "C:\Windows\Wallpaper.bmp"

Where C:\Folder\Wallpaper.vbs is the full qualified path to the Wallpaper.vbs script, and "C:\Windows\Wallpaper.bmp" is the fully qualified path to the wallpaper file.

Wallpaper.vbs contains:

Dim WshShell, oArgs
Set WshShell = WScript.CreateObject("Wscript.Shell")
set oArgs=wscript.arguments
If oArgs.Count > 0 Then
      WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", 
" & oArgs(0) &
" WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False Else Wscript.Echo "Syntax: CSCRIPT //NOLOGO C:\UTIL\Wallpaper.vbs ""C:\Windows\Wallpaper.bmp""" End If Set WshShell = Nothing



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish