本帖最后由 apang 于 2014-1-22 18:19 编辑
- @echo off & Setlocal Enabledelayedexpansion
- set /a Max1=Max2=0
- for /f "tokens=1-3" %%i in (1.txt) do (
- set /a n+=1
- set "_!n!_1=%%i" & set "_!n!_2=%%j" & set "_!n!_3=%%k"
- for %%a in (1 2) do (
- for %%b in (!n!) do (
- set "tmp=!_%%b_%%a!" & set "Len="
- for %%c in (2048 1024 512 256 128 64 32 16) do (
- if "!tmp:~%%c!" neq "" (
- set /a Len+=%%c & set "tmp=!tmp:~%%c!"
- )
- )
- set "tmp=!tmp!fedcba9876543210"
- set /a Len+=0x!tmp:~15,1! + 4
- if !Len! gtr !Max%%a! set "Max%%a=!Len!"
- )
- )
- )
- for %%a in (1 2) do (
- for /l %%b in (1 1 !Max%%a!) do set "sp%%a=!sp%%a! "
- )
- for /l %%a in (1 1 %n%) do (
- for %%b in (1 2) do (
- set "s=!_%%a_%%b!!sp%%b!"
- for %%c in (!Max%%b!) do set "str=!str!!s:~,%%c!"
- )
- echo,!str!!_%%a_3!&set "str="
- )
- pause
复制代码 如果存在中英文混合的列,那就对不齐 |