PDF download Download Article
Combine .txt files into one file with simple commands
PDF download Download Article

If you want to merge multiple text *(.txt) files into a single new file in Windows 10 or 11, you can easily do so in Command Prompt using the "copy" command. You can also merge text files using PowerShell commands, or by copying and pasting in Notepad. Before you get started, place all the files that need to be joined into a single folder.

Quick Steps

  1. Open the folder containing the files you want to combine.
  2. Hold down Shift and right-click in the folder.
  3. Click Open command window here or Open Terminal here .
  4. If using Terminal, click the down-arrow and select Command Prompt .
  5. Type copy *.txt newfile.txt and press Enter to merge.
Method 1
Method 1 of 3:

Using Command Prompt

PDF download Download Article
  1. Make sure all of your text files end with a blank line (or the dividing text of your choice) to make it clear where each section begins.

  2. Open the folder in which the text files are saved. Start by opening the This PC or Computer directory in the right panel, and then browse to the folder where you've saved your files. Once you open the folder, you should see your text files in the right panel.
    Advertisement
  3. A context menu will expand.
  4. This opens a command prompt window that's already set to the current directory.
    • If you're using Windows 11 and don't see the option to open the command window, select Open in Terminal instead. Then, once the Terminal is open, click the down-arrow at the top of the window and select Command Prompt .
    • If the option isn't available in Windows 10, right-click the taskbar at the bottom of the screen and select Taskbar settings . Toggle off the option that says "Replace Command Prompt with Windows PowerShell in the menu when I right-click the start button or press Windows key + x", then try again.
  5. This command combines all files ending in .txt into a single file called newfile.txt . You can replace newfile.txt with the name of the file you want to create (e.g., mergedfiles.txt ).
    • If you just want to combine two or more text files into a single file but not all text files in the directory, use the command copy file1.txt + file2.txt + file3.txt newfile.txt . Replace file1 , etc., with the names of the files you want to combine. [1]
    • Once you've verified that your output file looks how you'd like, you can delete the files you no longer need.
  6. Advertisement
Method 2
Method 2 of 3:

Using PowerShell

PDF download Download Article
  1. If you prefer using PowerShell to Command Prompt, merging text files into one is similar, but the commands are slightly different.
    • You'll want the files to be in the same folder to make things easier from the command prompt. If the files are scattered in multiple locations, copy them to a single folder first.
  2. Start by opening the This PC or Computer directory in the right panel, and then browse to the folder where you've saved your files. Once you open the folder, you should see your text files in the right panel.
  3. A context menu will expand.
  4. This opens a new PowerShell window to the directory that contains your text files.
  5. Replace file1.txt, etc., with the file names you want to merge. You can also replace newfile.txt with the name you want to give to the final merged file.
    • If you want to merge all text files in the current directory into a single text file, use the command Get-Content *.txt .
  6. Advertisement
Method 3
Method 3 of 3:

Using Notepad

PDF download Download Article
  1. If you just want to combine 2 or 3 text files into a single text file, you can do it easily with Notepad.
    • Open Notepad by typing notepad into the Windows search bar and clicking Notepad .
    • Click File > Open , select the first text file, then click Open .
    • Repeat for other text files you want to combine.
  2. If you're using Windows 11, go to File > New tab to create the file in a new tab. On Windows 10, just open another new instance of Notepad.
  3. An easy way to do this is to click anywhere in the text, press Ctrl + A on the keyboard to select all, then press Ctrl + C to copy.
  4. In your new blank Notepad file, click anywhere in the file, then press Ctrl + V to paste the copied text.
  5. Go to your next text file, press Ctrl + A to select all, then press Ctrl + C to copy. In your new blank file, click where you want to paste the copied text, then press Ctrl + V to paste.
  6. In the new file that contains your merged text, go to File > Save as , give the file a name, and click Save .
  7. Advertisement

Community Q&A

Search
Add New Question
  • Question
    Why am I getting extra copies of every file?
    Matt McCombs
    Community Answer
    You may have your output set to the same file type as your inputs.This would cause the program to read the output file after its initial creation and add in copies of the previously merged documents.
  • Question
    I have merged text files into one, but the prompt included the files in random order. Can it also merge files in an ordered fashion?
    Community Answer
    If you have three files, A.TXT, B.TXT and C.TXT and you want to combine them in the order CAB in the file CAB.TXT, you can use the copy command as follows: copy C.TXT+A.TXT+B.TXT CAB.TXT.
  • Question
    How do I separate the content of text files from one another?
    Community Answer
    You can take the text from the other ones, cut them and paste them into another text editing program, or you could just leave it alone and let them stay.
See more answers
Ask a Question
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      Article Summary X

      1. Open File Explorer.
      2. Open the folder that contains the text files.
      3. Press Shift and right-click in the folder.
      4. Click Open command window here .
      5. Type copy *.txt newfile.txt .
      6. Press Enter .

      Did this summary help you?
      Thanks to all authors for creating a page that has been read 791,123 times.

      Reader Success Stories

      • Maggie Fogarty

        Feb 24, 2017

        "Easy, simple, straightforward instructions that worked the very first time! Thanks for being extremely helpful."
      Share your story

      Is this article up to date?

      Advertisement