你是指最后的回车行是MORE留下的吧
代码再少点变量
另补上exit- @echo off&setlocal enabledelayedexpansion
- %1 %0 :|more /t32 >n.txt&exit
- set L=9
- set "file=a.txt"
- for /f "delims=U" %%a in ('cmd /u /c echo 唉') do set "tab=%%a"
- for /f "usebackq tokens=*" %%i in ("%file%") do set /a N+=1&set #!N!=%%i
- set /a h=(n+l-1)/l,j=n
- if !h! lss !l! set /a j=(n%%l)*h
- for /l %%i in (1 1 %n%) do (
- set /a "i=^!(~-%%i/j),m=(~-%%i-(^!i*j))%%(~-H+i)+1"
- for %%j in (!m!) do set "$%%j=!$%%j!%tab%!#%%i!"
- )
- for /l %%i in (1 1 %h%) do for /f "tokens=*" %%j in ("!$%%i!") do echo %%j
复制代码
|