2
我寫了一個小的vbs腳本來下載並更改當前用戶壁紙的註冊表。然而,它複製並做了改變,但壁紙不會改變...在下面的代碼錯誤的任何想法?在Windows 7中更改壁紙
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,False」更改爲「1,True」?其中一個答案中的代碼使用True,http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_7/Q_26745508.html – Russell 2011-03-07 00:56:17
另外,可能有一個原因是您正在使用VB腳本,但PowerShell可能會提供替代方案http://blogs.technet.com/b/heyscriptingguy/archive/2009/02/05/how-can-i-hide-my-desktop-wallpaper.aspx – Russell 2011-03-07 00:57:51