开发者

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 "\\anspksn开发者_如何学Pythonms1\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


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜