How to Merge Text Files (.Txt) in Command Prompt

Author: Louise Ward
Date Of Creation: 12 February 2021
Update Date: 1 July 2024
Anonim
How to merge multiple text files using cmd?
Video: How to merge multiple text files using cmd?

Content

This article shows you how to merge multiple text files in one new file using Windows Command Prompt. The simplest way to do this is to save the entire file to merge into one directory and use the merge command from that directory.

Steps

  1. and choose File Explorer. The Start menu appears in the lower right corner of the screen. You need to save the file to the same folder for the Command Prompt operation to be easier. If files are saved in more than one folder, be sure to first copy them to a separate folder.

    Make sure all text ends with a blank line (or have the text split your way) to delineate the boundaries of each piece of content after the texts are merged.


  2. Open the folder where the text files are saved. Please click This PC or Computer on the right side, then find the folder that contains your text files. After opening the folder, you will see text files displayed in the right part.

  3. Press the key ⇧ Shift while you right click on the empty space in the right part. A menu will appear here.

  4. Click Open command window here (Open command prompt here). This is to open a Command Prompt window with the path to the current directory.
    • If Windows PowerShell is enabled, you'll have to click Open PowerShell window here (Open the PowerShell window here).
  5. Import copy *. txt newfile.txt enter the Command Prompt window. Please change newfile.txt with the name of the file you want to create (eg mergedfiles.txt).
  6. Press ↵ Enter to merge files. This will create a new file containing the contents of all text files saved in the current directory.
    • Once you are satisfied with the results of the new file, you can delete files you no longer need.
    advertisement