在程序关闭时使用批处理文件更改墙纸.可能的? [英] Changing Wallpaper with a batch file, on program close. Possible?

查看:16
本文介绍了在程序关闭时使用批处理文件更改墙纸.可能的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个批处理文件,当程序在 Windows 7 上关闭时将更改我的背景.我尝试使用它,但它不起作用,即使我注销并重新登录:

I'm trying to create a batch file that will change my background when a program closes on Windows 7. I've tried using this, but it doesn't work, even when I log off and log back in:

@echo off
reg /add HKCUControl PanelDesktopWallPaper /v wallpaper /t REG_SZ /d c:imageswallpaper.bmp

推荐答案

你的命令有一些错误:

  1. 您已将不必要的 / 添加到 add 命令.
  2. 您不要将注册表项名称括在引号中(用于空格转义).
  3. 您指定了错误的路径(末尾有额外的 WallPaper).
  1. You have added unnecessarry / to add command.
  2. You don't enclose registry key name in quotes (for space escape).
  3. You have specified wrong path (extra WallPaper at the end).

这应该可以解决问题:

reg add "HKCUControl PanelDesktop" /v Wallpaper /f /t REG_SZ /d c:imageswallpaper.bmp

当然,如果壁纸路径包含空格,您也必须用引号将其括起来.

Of course, if the wallpaper path contains spaces you must enclose it in quotes too.

我还添加了键 /f 以在已设置壁纸的情况下强制覆盖.

I also added key /f to force overwriting if wallpaper is already set.

这篇关于在程序关闭时使用批处理文件更改墙纸.可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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