Combine multiple files into one using Windows Command Prompt

Combine multiple files into a single file is very simple on Windows as long as the files you are wanting to combine are text (binary). Its not possible to merge multiple images, videos and other none binary related content using this method. Here is the Command Prompt (cmd) command we will be using to achieve this.

We must use the /b attribute which tells the copy command that we are working with binary files. We then provide the file we wish to copy which in are case is “*.txt” which means every file which has the ending extension “.txt” and then the new location which is “combined.txt”.

You can replace .txt with what ever file extension is being used by your files and also change the name from combined.

Walkthrough

First we need to lunch Command Prompt (cmd) by going to “Start ->All Programs -> Accessories -> Command Prompt”.

This may differ slightly on other Windows versions as I am suing Windows 7.

Now browse to the location where the files you want to combine are stored and click on the navigation bar. It is the area highlighted in red in the image below. You want to copy the text inside by “right clicking -> Copy”.

Now go to the cmd screen we loaded up at the beginning (the black console screen) and type

Now either right click on the console screen or press the “INSERT” key located on the keyboard just above the arrow keys to insert the text we copied earlier. Now we need to add a ending ” character.

Now press the enter key (return key) and your screen should now look something like the following.

We have now moved the cmd window into the directory where we have stored the files we wish to combine. All you now have to do is run the copy command located at the top of this post. Here is an example of how my screen looked once I had run the copy command above but replaced the .txt with .log.

I now have a new file called combined.log which contains all the contents from the other files but in the single file.

Leave a Reply

20 − 13 =

6 Comments

  1. partha

    Thank a lot
    really this is a helpful things ..
    using this command not only .txt file any type file are merged

  2. ECN

    Hi!

    I have many files in .txt, and each file contains many data in the same format. In each file, each data are separated by “enter”. I want to combine all txt file into one file with each file name at the end of each data. Example: if I have below data

    – file1.txt:

    9,1,1,1

    1,8,1,2

    3,2,1,4

    – file2.txt:

    2,1,4,1

    3,1,1,2

    0,2,4,5

    And I want to combine to 1 txt file like this:

    9,1,1,1,file1

    1,8,1,2,file1

    3,2,1,4,file1

    2,1,4,1,file2

    3,1,1,2,file2

    0,2,4,5,file2

    Please help.

  3. Jill

    Oh, my goodness! This saved me a TON of work!! Thanks a bunch!!

  4. Malcolm

    Thanks for the very clear explanation. A colleague was having issues with a huge non-standard text file. We managed to wrangle it into shape by splitting it up and then processing each fragment, then reassembling was super easy thanks to these instructions, and no need to download any software.

Next ArticleIts been a while