把当前目录的1.jpg图片设置为桌面壁纸并立即生效
2023-9-15 乱云飞
@pushd "%~dp0" >nul 2>&1
@color 0A
@echo off
@mode con cols=50 lines=10
@title 截屏并设置为壁纸
REM 获取当前日期和时间
set datetime=%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%
REM 截取整个屏幕并保存为图片
nircmd.exe savescreenshot "1.jpg"
rem 把当前目录的1.jpg图片设置为桌面壁纸并立即生效
choice /T 3 /C ync /CS /D y /n >NUL
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "%cd%\1.jpg" /f
RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
choice /T 1 /C ync /CS /D y /n >NUL
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters 1, True
cmd/k
发表评论: