我写了一个小的vbs脚本来下载和更改当前用户墙纸的注册表。但是,它会复制并进行更改,但墙纸不会更改...有关以下代码中的错误的任何想法?

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

最佳答案

我不是vbscripter的专家,但也许可以尝试一下?

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

10-05 23:50