批处理文本输出

来源:百度知道 编辑:UC知道 时间:2024/06/03 19:17:12
如果有个1.txt文本中的内容是:
123
123
123
123
(一列数)
还有一个2.txt文本中的内容是:
234
234
234
234
(一列数)

怎么样才能创建一个3.txt,使其内容为:

123 234
123 234
123 234
123 234
(两列数,分别来自1.txt和2.txt)

麻烦写出批处理代码,多谢多谢!
对不起,如果有第三个文本文件a.txt,内容为:
aaa
bbb
ccc
ddd
如何与前两个文本文件一起合并为
123 234 aaa
123 234 bbb
123 234 ccc
123 234 ddd

请写出代码,多谢多谢

@echo off
cd.>>tmp.txt
set h=0
:h
if %h% GEQ 1 set "fc=skip=%h%"
set end=1
for /f %%i in ('dir /b *.tmp') do (
if not %%~nxi==tmp.txt set fi=%%~nxi&call:p
)

if %end%==0 echo.>>tmp.txt&set/a h+=1&goto h
exit
:p
for /f "%fc%" %%j in ('type %fi%') do (
set/p=%%j <nul>>tmp.txt
set end=0
set tab=0
echo %fi% %h% %tab%
goto :eof
)
if "%tab%"=="1" set/p= <nul>>tmp.txt
set tab=1

..........

@echo off & setlocal enabledelayedexpansion
if exist 3.txt del 3.txt
:a
for %%a in (1.txt 2.txt a.txt) do set "a=%%a" & call :b
set /a n+=1
set "sk=skip=%n%"
if "!b!"=="" pause & exit
echo !b!>>3.txt
set "b=" & goto a
:b
for /f "%sk% delims=" %%b in (%a%) do set "b=!b!%%