我想从命令行刷新Windows 7中的壁纸。我正在通过reg.exe add
设置壁纸。
rundll32.exe user32.dll,UpdatePerUserSystemParameters
不起作用(与1,True
或1,False
)
要求:
杀死资源管理器永远不是一个好主意,试试这个:
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True
至少在Windows 7 64位上,我发现rundll32.exe命令有效,但不是每次都有。我没有关于原因的理论,但我的解决方法是一个多次调用它的.cmd文件。它并不优雅但每次都有效。在我们的环境中,我们在后台异步和不可见的情况下启动它,所以它运行大约80秒的事实并不重要。
:: 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
比我想象的更难。根据您的其他需求,您最终可以重新启动资源管理器。
taskkill /IM explorer.exe /F
explorer.exe
如果你可以从命令行调用程序,你也可以查看How to force Windows desktop background to update or refresh
reg。使用.bmp文件更好地工作
这需要用户执行rundll32多个?时
尝试一个简单的重命名转换picture.jpeg - > picture.bmp