@echo off&setlocal enabledelayedexpansion
::设置母目录,此脚本可放在子文件夹以外的任何地方
SET "path=D:\test2\照片"
cd /d "%path%"
for /f %%a in ('dir /ad /b /s') do (
set /a num=0
cd /d "%%~a"
for /r %%i in (*) do (
set /a num+=1
if !num! LEQ 9 ( ren "%%i" "照片-0!num!%%~xi" ) else ( ren "%%i" "照片-!num!%%~xi" )
echo %%i
))
pause