问题描述:

This has been asked before here in a different form ( Powershell - Change windows 7 background to image off a website ) but I am still running into a bit of trouble here

I have a variable in windows 7 (PC):

Set-Variable DEF_IMG -value 'C:\Windows\Web\Wallpaper\Windows\img0.jpg'

And I have tried a number of things:

set-ItemProperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value $DEF_IMG

set-ItemProperty 'HKCU:\Software\Microsoft\Internet Explorer\Desktop\General' -name WallpaperSource -value $DEF_IMG

REG add 'HKCU\Control Panel\Desktop' /v Wallpaper /t REG_SZ /d $DEF_IMG /f

regedit /s $DEF_IMG

and at the end of course I always try

RUNDLL32.exe user32.dll, UpdatePerUserSystemParameters, 1, True

Once in a blue moon running some of those scripts seem to change the actual background, but most of the time the values in the registry change but the image stays the same. As for when it changes, there does not seem to be any rhyme or reason behind it. I think I am missing something important about how Windows handles its background image vs themes.. or something?

I am trying to do all of it directly in Powershell (no C code, no extra plug-ins or extensions, trying to maintain a clean system)

相关阅读:
Top