Change wallpaper in Windows 7

I wrote a small vbs script to download and modify the registry for current user wallpapers. however, it copies and makes changes, but the wallpaper does not change ... any ideas about errors in the code below?

Option Explicit
Dim WshShell, strValue, sleepTime, oFSO

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

Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "\\anspksnms1\OSD\Scripts\wallpaper\wallpaper.bmp", "C:\"

Set WshShell = WScript.CreateObject("Wscript.Shell") 
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", strValue
WScript.Sleep sleepTime
WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters", 1, False

Set WshShell = Nothing
+3
source share
1 answer

I don't really like vbscripter, but maybe try this?

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

Source: https://habr.com/ru/post/1796706/


All Articles