@echo off
setlocal enabledelayedexpansion set prefix="mai" set /a num=000 rem 排序/o:? -代表逆序 rem n按名称的字母顺序 rem e按扩展名的字母顺序 rem d按日期和时间,最早的优先 rem s按大小,最小的优先 rem g在文件之前分组的目录 for /f "tokens=* delims=" %%i in ('dir /b /a-d /o:-d *.jpg') do ( set /a num=num+1 set tmp=!num! rem echo "%%i" rem if !tmp! lss 10 (echo 00!tmp!) else if !tmp! lss 100 (echo 0!tmp!) else if !tmp! lss 1000 (echo !tmp!) if !tmp! lss 10 (ren %%i %prefix%_00!tmp!.jpg) else if !tmp! lss 100 (ren %%i %prefix%_0!tmp!.jpg) else if !tmp! lss 1000 (ren %%i %prefix%_!tmp!.jpg) rem ren "%%i" mai3_!tmp!.jpg ) pause 收藏于 2014-06-26
来自于百度空间