在FOR里调用FIND会影响效率;要利用SET的话 这样效率会提高点- @echo off&setlocal enabledelayedexpansion
- set file=1.txt
- for /f "delims=" %%a in (%file%) do (
- for /f "tokens=2 delims=." %%b in ("%%a") do (
- if defined _%%b (
- set str=!_%%b!
- set /a t=1+str
- set _%%b=!t!
- ) else set _%%b=10000
- set #!_%%b!#%%b=%%a
- )
- )
- for /f "tokens=1,2 delims=#=" %%i in ('set #^|sort /r') do (
- for /l %%k in (10000,1,%%i) do echo !#%%k#%%j!
- )
- pause
复制代码
|