'Using CMD How i create a new file that combines lines from from two other text files?
Here is what I am trying to achieve...
File1.txt
I love
File2.txt
Cake
Cheese
Money
File3.txt aka results.txt
I love Cake
I love Cheese
I love Money
I found the script below from another post, but it does not take into account the fact that one File only has one line while the other file has many lines.
@echo off
setlocal DisableDelayedExpansion
(
< file2.txt (
for /F "delims=" %%a in (file1.txt) do (
set file2Line=
set /P file2Line=
set "file1Line=%%a"
setlocal EnableDelayedExpansion
echo(!file1Line!!file2Line!
endlocal
)
)
)>"result.txt"
pause
Thank you for the assist in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|