ngd 当前离线
上等兵
@echo off&setlocal enabledelayedexpansion for /f %%a in (a.txt) do ( set str=%%a echo !str! for /l %%i in (5,-1,0) do ( if "!str!" NEQ "!str:%%i=!" echo %%i ) ) pause复制代码
WHY 当前离线
上校
@echo off & setlocal enabledelayedexpansion for /f "delims=" %%i in (a.txt) do ( set "s=%%i" & set "max=" for /l %%j in (9 -1 0) do if "!s:%%j=!" NEQ "!s!" if not defined max set "max=%%j" echo;!s!&echo;!max! )复制代码
TOP
@echo off & setlocal enabledelayedexpansion for /f "delims=" %%i in (a.txt) do ( set "s=%%i" & set "max=" for /l %%j in (0 1 9) do if "!s:%%j=!" NEQ "!s!" set "max=%%j" echo;!s!&echo;!max! )复制代码
pcl_test 当前离线
荣誉版主
powershell -c "gc 'a.txt'|%%{$_+' '+($_ -split ''|sort)[-1]}" pause复制代码
@echo off for /f %%a in ('type "a.txt"') do ( set str=%%a&set/p=%%a <nul setlocal enabledelayedexpansion for /l %%i in (0,1,10) do (rem 指定数字最大长度为10位数 if not defined max ( set max=!str:~%%i,1! ) else if !str:~%%i^,1! geq !max! set max=!str:~%%i,1! ) echo;!max! endlocal ) pause复制代码
@echo off for /f %%a in ('type "a.txt"') do ( set str=%%a echo;%%a call :loop %%a ) pause&exit :loop set num=%~1 setlocal enabledelayedexpansion for /l %%i in (9,-1,0) do ( if "!num!" neq "!num:%%i=!" echo;%%i&goto :eof )复制代码