- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /b /a-d *.txt') do (
- set /a n1=n3=0
- for /f "delims=" %%b in ('type "%%a"') do (
- set "str1=%%b"
- set /a n1+=1,n2=0
- for /l %%m in (0,1,30) do (
- if not "!str1:~%%m,1!" equ "" (
- set /a n2+=1,n3+=1
- >>"%%~na.!n1!.!n2!%%~xa" echo !str1:~%%m,1!
- )
- )
- if !n2! geq !n3! (
- set n3=!n2!
- )
- )
- >1.2.2.txt echo 0
- for /l %%p in (1,1,!n1!) do (
- set "str3="
- for /l %%q in (1,1,!n3!) do (
- if exist "%%~na.%%p.%%q%%~xa" (
- set /p str2=<"%%~na.%%p.%%q%%~xa"
- set "str3=!str3!!str2!"
- )
- )
- >>"%%~na-#%%~xa" echo !str3!
- )
- )
- endlocal
- pause
复制代码
|