test.bat
AAA3个字符 -> key=AAA,len=3- @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "key=AAA"
- set "len=3"
- (
- for %%i in (%key%*) do (
- set "line=%%~ni"
- set "line=0000000000!line:~%len%!"
- echo !line:~-10!;%%~i
- )
- )>$
- for /f "tokens=2 delims=;" %%i in ('sort $') do (set "tag=%%i" & goto :next)
- :next
- echo %tag%
- del /f "%tag%"
- del /f "$"
- pause&exit
复制代码
|