Reputation: 91
Hi guys I have folder with large number of txt files.
start.txt
end.txt
text1.txt
text2.txt
text3.txt
...
I need to create batch file/command who will merge files like this:
start.txt -> text1.txt -> end.txt to text1.txt
start.txt -> text2.txt -> end.txt to text2.txt
I can put start.txt and end.txt outside folder, so its easier to work with.
So my new text1.txt will look like:
text1.txt
start.txt
text1.txt
end.txt
And so on..
Upvotes: 0
Views: 139
Reputation: 354386
You don't even need a batch file for that:
for %F in (*.txt) do copy ..\start.txt+%F+..\end.txt ..\new_%F
If used in a batch file you need to double the %
:
for %%F in (*.txt) do copy ..\start.txt+%%F+..\end.txt ..\new_%%F
Upvotes: 2