Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am thinking looking for a way to combine all the .txt files in a directory into a single one .txt file.

Is there a way to combine text files using the Windows command line?

share|improve this question
up vote 19 down vote accepted

You can also use the copy command, eg

copy *.js bigfile.txt

or, for specific files

copy file1.txt+file2.txt+file3.txt bigfile.txt
share|improve this answer
+1 - This also allows you to decide what order to have the combined result set in. – JNK Sep 21 '10 at 20:51
Good, thanks... – DanC Sep 23 '10 at 20:08
This included the BOM in my textfiles so I fixed it my using type commando (see DanC's answer) ( – Torbjörn Hansson Sep 12 '12 at 11:42
type * > someotherpath/all.txt

The need for creating the file somewhere else is that if the new file is created on the same folder, it should be excluded from the selection.

Also, filtering by extension and using a different one for the resulting file would work. For example:

type *.js > all.txt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.