修改桌面背景

2016年1月11日 0 条评论 549 次阅读 0 人点赞
@echo off
::请将作为背景图片的图片先打开,然后设置为桌面背景
::然后将
::%USERPROFILE%\Local Settings\Application Data\Microsoft
::下的Wallpaper1.bmp放置到与本程序同目录内
::注销后生效

::为后面注册表导入项取得当前用户路径
for /f "tokens=1,2,3 delims=\" %%i in ('echo %USERPROFILE%') do (
    set a=%%i
    set b=%%j
    set c=%%k
)

::复制背景图片到指定目录
copy /y Wallpaper1.bmp "%USERPROFILE%\Local Settings\Application Data\Microsoft\Wallpaper1.bmp"

::导出桌面背景设置相关的注册表项
::reg export "HKEY_CURRENT_USER\Control Panel\Desktop" desktopp.reg

::判断当前是否设置了背景图片
::for /f "tokens=2 delims==" %%i in ('type desktopp.reg ^| find /n "Wallpaper" ^|find "33"') do (
::    del /q desktopp.reg
::    if %%i=="" echo 没有设置背景& goto :01
::    goto :10
::)

::设置为指定背景
:01
>desktop01.reg echo Windows Registry Editor Version 5.00
>>desktop01.reg echo.
>>desktop01.reg echo [HKEY_CURRENT_USER\Control Panel\Desktop]
>>desktop01.reg echo.
>>desktop01.reg echo "Wallpaper"="%a%\\%b%\\%c%\\Local Settings\\Application Data\\Microsoft\\Wallpaper1.bmp"
>>desktop01.reg echo "OriginalWallpaper"="%a%\\%b%\\%c%\\Local Settings\\Application Data\\Microsoft\\Wallpaper1.bmp"
>>desktop01.reg echo "ConvertedWallpaper"=""
regedit /s desktop01.reg
del /q desktop01.reg
echo 设置完成,注销后生效...&pause>nul&goto :eof

::设置为没有背景
:10
pause
>desktop10.reg echo Windows Registry Editor Version 5.00
>>desktop10.reg echo.
>>desktop10.reg echo [HKEY_CURRENT_USER\Control Panel\Desktop]
>>desktop10.reg echo.
>>desktop10.reg echo "Wallpaper"=""
>>desktop10.reg echo "OriginalWallpaper"="%a%\\%b%\\%c%\\Local Settings\\Application Data\\Microsoft\\Wallpaper1.bmp"
>>desktop10.reg echo "ConvertedWallpaper"=""
regedit /s desktop10.reg
del /q desktop10.reg

Sevenfal

这个人太懒什么东西都没留下

文章评论(0)