|
set x=haha & ...
set x=haha& ...
是不一样的。。。修正你的几个小BUG
支持带空格文件名,且不会卡在bmp格式上。
- @echo off
- setlocal enabledelayedexpansion
- set p=%SystemDrive%\Tools\Pic
- set cwp=%USERPROFILE%\Local Settings\Application Data\Microsoft\Wallpaper1.bmp
- for /f "skip=4 tokens=1,2,*" %%i in ('reg query "HKCU\Control Panel\Desktop" /v Wallpaper') do (
- set d=%%k
- set w=%%~nxk
- )
- if not "%d%"=="%cwp%" goto :nw
- for /f "skip=4 tokens=1,2,*" %%i in ('reg query "HKCU\Control Panel\Desktop" /v ConvertedWallpaper') do (
- set w=%%~nxk
- )
- :nw
- set d=
- for /f "delims=" %%i in ('dir %p%\*.* /b /on') do (
- if "!w!"=="" set "w=%%i" & goto next
- if "!d!"=="" set d=%%i
- if "!w!"=="found" set "w=%%i" & goto next
- if "%%i"=="!w!" set w=found
- )
- set w=%d%
- :next
- pecmd.exe WALL "%p%\%w%"
复制代码 |
|