Solved Batch to combine two text files into one

March 8, 2010 at 11:35:46
Specs: Windows XP
Hello I would like a simple Batch command to
combine test1.txt and test2.txt into test3.txt

See More: Batch to combine two text files into one

Report •

✔ Best Answer
March 8, 2010 at 12:37:55
Try this

copy test1.txt+test2.txt test3.txt

MIKE

http://www.skeptic.com/



#1
March 8, 2010 at 11:48:36
text1.txt contains
monkey

test2.txt contains
apple
banana
pear

test2.txt should contain
monkey
apple
banana
pear


Report •

#2
March 8, 2010 at 11:55:23
copy test1.txt+test2.txt

Copy the contents in test2.txt and combines it with the contents in test1.txt.

Rename your test1.txt file.

MIKE

http://www.skeptic.com/


Report •

#3
March 8, 2010 at 12:05:06
I want to leave 1 and 2 alone can you copy to a new file?

Report •

Related Solutions

#4
March 8, 2010 at 12:24:11
i tried:
@echo off > 3.txt
Copy 3.txt+1.txt
Copy 3.txt+2.txt
but now between the two files in the first space of the first line of
the second file is a little box symbol, (Sub) in notepad++


Report •

#5
March 8, 2010 at 12:37:55
✔ Best Answer
Try this

copy test1.txt+test2.txt test3.txt

MIKE

http://www.skeptic.com/


Report •

#6
March 8, 2010 at 12:55:27
that worked

TY


Report •

#7
March 8, 2010 at 13:04:49
Glad I could help.

FYI if your going to be doing Batch programs, you would be better off posting your questions in the Programming Forum.

MIKE

http://www.skeptic.com/


Report •

#8
March 22, 2010 at 08:35:03
Thank you, will do so from now on, follow up question, at the end
of the combined file i am getting a weird char, it is a box and if i
open it in NotePad++ it calls it Sub. any idea how to get rid of
that?

same issue as before but now at the end of the combined file, did not scroll down far enough before.


Report •

#9
March 22, 2010 at 10:54:17
Special Characters

It is probably a Carriage Return character,
or Carriage Return - Line Feed characters.

I'm not familiar with Notepad++ so I do not know what it will display or how it displays it.

MIKE

http://www.skeptic.com/


Report •

#10
March 22, 2010 at 11:39:27
ended up useing
type test1.txt >>test3.txt
type test2.txt >>test3.txt

Report •

#11
September 11, 2010 at 04:48:35
Same here! I was trying to merge a lot of files into one file with

copy file1.txt+file2.txt+file3.txt mergefile.txt

And I had the mysterious [sub] character at appended end!

So finally used:

del mergefile.txt
type file1.txt >> mergefile.txt
type file2.txt >> mergefile.txt
type file3.txt >> mergefile.txt


Report •

Ask Question