本帖最后由 pcl_test 于 2015-9-7 22:32 编辑
- @echo off
- md "统计结果" 2>nul
- for %%a in (*.txt) do (
- setlocal enabledelayedexpansion
- (for %%i in (1 2) do set /p _%%i=)<"%%a"
- (
- echo;!_1!&echo;!_2!
- for /f "skip=12 usebackq tokens=1*" %%b in ("%%a") do (
- set "str=%%c"
- set "str=!str:__=!"
- for %%d in (!str!) do set/a "#%%d+=1"
- )
- for /f "tokens=1,2 delims=#=" %%e in ('set #') do (
- echo;%%e %%f
- if "%%e" neq "22" set/a s+=%%f
- )
- echo;除22以外的统计数总和为!s!
- )>"统计结果\%%a"
- endlocal
- )
- pause
复制代码
|