How to change wallpaper using batch

◇◆丶佛笑我妖孽 提交于 2019-12-10 10:28:47

问题


I need to make a batch file that changes the wallpaper to a picture that is in the same location as the bat file I currently have this code:

reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d c:\images\wallpaper.bmp

the problem with this is that it the pictures need to be in the folder c:\images\ and I need it to be in the same place as the bat file. does any one know how I could do it.


回答1:


You can use %~dp0wallpaper.bmp

%~dp0 returns the full path of the batch file that is being executed with a backslash at end.

You probably might want to enclose the filename in double quotes in case the batch file's directory contains spaces: "%~dp0wallpaper.bmp"



来源:https://stackoverflow.com/questions/20093278/how-to-change-wallpaper-using-batch

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