Change Wallpaper in Windows 7


Change Wallpaper in Windows 7



I have written a small vbs script to download and change the registry for the current users wallpaper. however it copies and does the change but the wallpaper does not change... any ideas on errors in the below code?


Option Explicit
Dim WshShell, strValue, sleepTime, oFSO

strValue = "C:wallpaper.bmp"
sleepTime = 30000

Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "anspksnms1OSDScriptswallpaperwallpaper.bmp", "C:"

Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCUControl PanelDesktopWallpaper", strValue
WScript.Sleep sleepTime
WshShell.Run "%windir%System32RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False

Set WshShell = Nothing





Have you tried changing "1, False" to "1, True"? The code in one of the answers uses True, experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/…
– Russell
Mar 7 '11 at 0:56





Also, there may be a reason you are using VB Script, but PowerShell may provide an alternative blogs.technet.com/b/heyscriptingguy/archive/2009/02/05/…
– Russell
Mar 7 '11 at 0:57




1 Answer
1



I'm not much of a vbscripter, but maybe try this?


wshShell.run "cmd /c RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters", 1, True






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV