本代码可适用于多次重复的情况- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (a.txt) do set /a _%%a+=1
- for /f "delims=_=" %%a in ('set _') do (
- if !_%%a! neq 1 (
- for /l %%b in (1,1,!_%%a!) do echo %%a
- ) else (
- set /a n+=1&set "_!n!=%%a"
- )
- )
- for /l %%a in (1,1,!n!) do echo !_%%a!
- pause>nul
复制代码
[ 本帖最后由 batman 于 2009-2-27 20:25 编辑 ] |