问题
The first part of the script does work (when the key exists - if not that's OK, that's why I have On Error Resume Next
).
But the 2nd part is what I am concerned about. It DOES NOT ERR, and I can see in Regedit that it did, indeed, set the Background to "0 0 0", but when I refresh the wallpaper, nothing has changed.
Oddly, if I manually change the wallpaper color, then refresh the screen in Regedit, I DO see the value change.
So everything is telling me this should be working, but it's not. The bold line is all I'm really concerned about.
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
on error resume next 'it may not exist
WSHShell.RegDelete _
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\Wallpaper"
On Error GoTo 0
wshShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Colors\Background", "0 0 0","REG_SZ"
来源:https://stackoverflow.com/questions/24411495/set-registry-key-for-wallpaper-solid-color