- @echo off
- setlocal enabledelayedexpansion
- ::提取相同文件名的txt、doc、xls文件总大小
- for /f "delims=" %%a in ('dir /b *.txt *.doc *.xls') do (
- if not defined %%~na (
- set s=0
- for /f "delims=" %%b in ('dir /b "%%~na.*" ^|findstr /i "\.txt \.doc \.xls"') do set /a "s+=%%~zb/1024"
- echo,%%~na !s!KB
- set %%~na=def
- )
- )
- pause
复制代码
|