重温一下 前面发过没?前面随风兄提示直接for的 后面冒泡排- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in (a.txt) do (
- for %%j in (%%i) do (
- set "str=%%j"
- for %%k in (!str:~-1!) do set/a _%%k+=1&set "_%%k_!_%%k!=%%j"
- )
- )
- for /l %%a in (0,1,9) do if defined _%%a (
- set /a "c=_%%a-1"
- for /l %%i in (1,1,!c!) do (
- set /a "b=%%i+1"
- for /l %%j in (!b!,1,!_%%a!) do (
- if !_%%a_%%i! gtr !_%%a_%%j! set/a "_%%a_%%j=!_%%a_%%i!,_%%a_%%i=!_%%a_%%j!"
- )
- )
- for /l %%i in (1,1,!_%%a!) do set "var=!var! !_%%a_%%i!"
- echo;%%a!var!&set "var="
- )
- pause
复制代码
|