在Windows 7中更改壁纸

时间:2011-03-07 00:48:07

标签: windows-7 vbscript

我已经编写了一个小的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

1 个答案:

答案 0 :(得分:0)

我不是一个vbscripter,但也许试试这个?

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