- @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "src=D:\phpstudy_pro\WWW\xdzmb"
- set "dest=D:\phpstudy_pro\WWW\fff"
- for /r "%src%" %%i in (*.png) do (
- if exist "%dest%\%%~nxi" (
- set "n=1"
- call :getNext "%dest%\%%~nxi"
- set "tag=%dest%\%%~ni(!n!)%%~xi"
- ) else set "tag=%dest%\%%~nxi"
- echo %%i
- echo !tag!
- copy "%%i" "!tag!"
- echo --------------------
- )
- pause&exit
- :getNext
- if exist "%~dpn1(!n!)%~x1" set /a "n+=1" & goto :getNext "%dest%\%%~nxi"
- goto :eof
复制代码
|