确实应该把情况说详细些, 估计是一行字符太多... 拼凑了一段 —— 针对文本仅一长行 为输出整齐一点, 取每个统计数最多3位数 (不然修改这句 set/p "= %%a 有!b.:~-3!")- @echo off <nul 3<1.txt
- setlocal enabledelayedexpansion
- :lp
- set a=&set/p a=
- if "%a%"=="" goto :next
- if "%a: =%"=="" goto :next
- for %%b in (%a%)do (
- set/a y!o!%%b+=1
- set "o=%%b"
- )
- goto :lp
- :next
- for /L %%i in (0 1 9)do for /L %%j in (0 1 9)do (
- set/a "u=!y%%i%%j!+100000"
- set/a "#%%i#!u!#%%j=!y%%i%%j!+0"
- )
- (for /L %%h in (0 1 9)do (
- set/p"=%%h 后:"
- set n=0
- for /f "tokens=3,4 delims=#=" %%a in ('set #%%h')do (
- set "b.= %%b"
- set/p "= %%a 有!b.:~-3!"
- if !n! neq 9 set/p "i=, "
- set/a n+=1
- )
- echo\
- ))<nul>2.txt
- endlocal<nul 4<con
- pause
复制代码
|