通过命令行在win7中刷新壁纸

问题描述 投票:1回答:4

我想从命令行刷新Windows 7中的壁纸。我正在通过reg.exe add设置壁纸。

rundll32.exe user32.dll,UpdatePerUserSystemParameters不起作用(与1,True1,False

要求:

  1. 它必须立即刷新壁纸(无需等待)
  2. 它必须从命令行运行
  3. 默认的Windows 7命令行是首选。编写c ++ / VB / C#程序是可以接受的,但不如默认的win7 cli解决方案好。
windows windows-7 wallpaper
4个回答
1
投票

杀死资源管理器永远不是一个好主意,试试这个:

RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True

1
投票

至少在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

0
投票

比我想象的更难。根据您的其他需求,您最终可以重新启动资源管理器。

taskkill /IM explorer.exe /F
explorer.exe

如果你可以从命令行调用程序,你也可以查看How to force Windows desktop background to update or refresh


0
投票

reg。使用.bmp文件更好地工作

这需要用户执行rundll32多个?时

尝试一个简单的重命名转换picture.jpeg - > picture.bmp

© www.soinside.com 2019 - 2024. All rights reserved.