|
代码如下:
@echo off
title 更换壁纸
setlocal enableDelayedExpansion
set pic=%1
if "!pic!"=="" call :search
if "!pic!"=="" set pic="%userProfile%\Local Settings\Application
Data\Microsoft\Wallpaper1.bmp"
echo 正在添加注册表项目...
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d !pic! /f>nul
reg add "HKCU\Control Panel\Desktop" /v WallpaperStyle /d "2" /f>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v Wallpaper /d !
pic! /f>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v WallpaperStyle
/d "2" /f>nul
echo 正在更换桌面背景
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
goto :eof
:search
cd/d "%~dp0"
for /f "delims=" %%a in ('dir/b *.jpg *.bmp') do (
set pic="%~dp0%%a"
)
goto :eof
============================================================
::确保有"%userProfile%\Local Settings\Application Data\Microsoft\Wallpaper1.bmp"
@echo off
title 还原壁纸
set pic="%userProfile%\Local Settings\Application Data\Microsoft\Wallpaper1.bmp"
echo 正在添加注册表项目...
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /d %pic% /f>nul
reg add "HKCU\Control Panel\Desktop" /v WallpaperStyle /d "2" /f>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v Wallpaper /d %
pic% /f>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v WallpaperStyle
/d "2" /f>nul
echo 正在还原桌面背景
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
goto :eof
分两步完成,这是目前不用THEMEUI.DLL支持也能换JPG背景的办法
|
|
|
|
|
|
|