1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| @echo off & cls
setlocal enabledelayedexpansion
set current_path=%~dp0
set current_path_modified=%current_path:~0,-1%
set "ProcessToKill=explorer"
ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
echo Xindows_XP
for /f %%x in ('dir /s/b "%current_path_modified%\*.bmp"') do (
set "Wallpaper=%%x"
)
if exist "%Wallpaper%" (
set "UserWallpaperLocation=C:\WINDOWS\web\wallpaper\TranscodedWallpaper.bmp"
if exist "%UserWallpaperLocation%" del /F /S /Q "%UserWallpaperLocation%"
copy "%Wallpaper%" "!UserWallpaperLocation!" /Y
reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "!UserWallpaperLocation!" /f
)
) else (
for /f %%y in ('dir /s/b "%current_path_modified%\*.jpg"') do (
set "Wallpaper=%%y"
)
if exist "%Wallpaper%" (
set "UserWallpaperLocation=%UserProfile%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg"
if exist "%UserWallpaperLocation%" del /F /S /Q "%UserWallpaperLocation%"
copy "%Wallpaper%" "%UserWallpaperLocation%" /Y
)
)
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
tasklist /FI "IMAGENAME eq %ProcessToKill%.exe" 2>NUL | find /I /N "%ProcessToKill%.exe">NUL
if "%ERRORLEVEL%"=="0" (
TASKKILL /F /IM %ProcessToKill%.exe
)
start explorer.exe
exit |
Partager