本帖最后由 smss 于 2020-6-6 20:12 编辑
以下脚本保存为ANSI编码放在你描述的A B文件夹所在目录执行- @echo off&setlocal enabledelayedexpansion
- for /d %%a in (*) do for /d %%b in (%%a\*) do (ren "%%~fb" "%%~na-%%~nb"&cd "%%a\%%~na-%%~nb"&set n=0
- for /f "delims=" %%i in ('dir /b/s "*.jpg"') do (set "p=%%~dpi"&cd/d "!p!..\.."&call set "pf=%%p:!cd!\=%%"&set /a n+=1
- if !n! lss 10 (ren "%%i" "!pf:\=-!00!n!%%~xi")else if !n! lss 100 (ren "%%i" "!pf:\=-!!0n!%%~xi")else ren "%%i" "!pf:\=-!!0n!%%~xi"))
- pause
复制代码 或者- @echo off&setlocal enabledelayedexpansion
- for /d %%a in (*) do for /d %%b in (%%a\*) do (ren "%%~fb" "%%~na-%%~nb"&cd "%%a\%%~na-%%~nb"&set n=1000
- for /f "delims=" %%i in ('dir /b/s "*.jpg"') do (set "p=%%~dpi"&cd/d "!p!..\.."&call set "pf=%%p:!cd!\=%%"&set /a n+=1&set m=!n:~1!
- ren "%%i" "!pf:\=-!!m!%%~xi"))
- pause
复制代码
|