通过命令行在win7中刷新壁纸 [英] Refresh wallpaper in win7 via command line

查看:44
本文介绍了通过命令行在win7中刷新壁纸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to refresh wallpaper in Windows 7 from command line. I'm setting wallpaper via reg.exe add.

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

rundll32.exe user32.dll,UpdatePerUserSystemParameters doesn't work (with 1,True or 1,False)

要求:

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

推荐答案

至少在 Windows 7 64 位上,我发现 rundll32.exe 命令有效,但不是每次都有效.我不知道为什么,但我的解决方法是一个 .cmd 文件,它会多次调用它.它并不优雅,但每次都有效.在我们的环境中,我们在后台异步且不可见地启动它,因此它运行大约 80 秒的事实并不重要.

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

这篇关于通过命令行在win7中刷新壁纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆