Refresh wallpaper in win7 via command line

ε祈祈猫儿з 提交于 2019-12-04 19:26:36
Jon Dev

Killing explorer is never a good idea, try this:

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True

At least on Windows 7 64-bit, I found that the rundll32.exe command worked, but just not every time. I don't have a theory of why, but my workaround was a .cmd file that calls it a lot of times. It's not elegant but it works every time. In our environment, we are launching it in the background async and invisible, so the fact that it runs for about 80 seconds just doesn't matter.

:: Do your stuff to apply the background .reg settings first
:: Then run UpdatePerUserSystemParameters many times
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True
timeout 1
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True
timeout 1
:: Etc. I have about 80 of them
Alexander Taubenkorb

Harder than I thought. Depending on your other needs you could eventually restart explorer.

taskkill /IM explorer.exe /F
explorer.exe

If you can call a program from the command line, you could also look at How to force Windows desktop background to update or refresh

reg add works better using .bmp files

this requires users to execute rundll32 multiple? times

try a simple rename conversion picture.jpeg -> picture.bmp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!