将我19楼的代码简化并提效如下:- @echo off&setlocal enabledelayedexpansion
- for /l %%a in (0,1,9) do (
- for /f "delims=" %%b in (b.txt) do (
- for %%c in (%%b) do (
- set /a num=%%c-%%a,num=num%%10
- if !num! equ 0 (
- set "str=000%%c"&set "str=%%a!str:~-3!"
- if defined _!str! (
- call,set "_!str!=%%_!str!%% %%c"
- ) else (
- set "_!str!=%%c"
- )
- )
- )
- )
- )
- for /f "tokens=1,2 delims==_" %%a in ('set _') do (
- set "str=%%a"&set "str=!str:~,1!"
- if not defined !str! (
- echo.&set /p=!str! %%b <nul&set "!str!=a"
- ) else (
- set /p=%%b <nul
- )
- )
- pause>nul
复制代码
|