CODE: [Copy to clipboard]
@echo off&Setlocal EnableDelayedExpansion
set maxcols=1
set maxline=1
copy nul 3.txt >nul
call :context 1.txt
call :context 2.txt
call :result 1.txt 2.txt
start notepad.exe 3.txt
pause&goto :eof
:context
set flag=%1
set line=1
for /f "delims=" %%a in (%flag%) do (
set cols=1
for %%b in (%%a) do (
set %flag%!line!!cols!=%%b
set /a cols+=1
if !maxcols! leq !cols! set /a maxcols=!cols!
)
set /a line+=1
if !maxline! leq !line! set /a maxline=!line!
)
for /l %%z in (1,1,%maxline%) do (
for /l %%y in (1,1,%maxcols%) do (
set/p=!%flag%%%z%%y! <nul
)
echo\
)
goto :eof
:result
for /l %%z in (1,1,%maxline%) do (
for /l %%y in (1,1,%maxcols%) do (
if defined %1%%z%%y if defined %2%%z%%y (set /a _%%z%%y=!%1%%z%%y!+!%2%%z%%y!)
set/p=!_%%z%%y! <nul
>>3.txt set/p=!_%%z%%y! <nul
)
echo\>>3.txt
echo\
)
1.txt内容如下: