回复 1# crownking1983 - @echo off
- setlocal enabledelayedexpansion
- ::设置图片格式,如果所有文件夹里只有图片文件,则不需要设置,否则自行添加图片格式,修改为set "ext=*.jpg *.png *.bmp"
- set ext=
- for /f "delims=" %%i in ('dir /ad /b') do (
- set n=0
- set size=0
- pushd "%%i\"
- for /f "tokens=1-4" %%a in ('dir /a-d !ext! 2^>nul ^|find "个文件"') do (
- set n=%%aP
- set size=%%c
- set size=!size:,=!
- if !size! lss 1024 set s=!size!B
- if !size! geq 1024 if !size! lss 1048576 (set /a s=!size!/1024 & set s=!s!K)
- if !size! geq 1048576 (set /a s=!size!/1048576 & set s=!s!M)
- )
- popd
- ren "%%i" "%%i [!n! !s!]"
- )
- pause
复制代码
|