How to concatenate text (TXT) files using the command line

Table of contents:

How to concatenate text (TXT) files using the command line
How to concatenate text (TXT) files using the command line
Anonim

This article will show you how to use the Windows command line to combine multiple text files into one new file. To do this, copy all text files into one folder and then run a special command.

Steps

Merge Text (. Txt) Files in Command Prompt Step 1
Merge Text (. Txt) Files in Command Prompt Step 1

Step 1. Right Click on the Start Menu

Windowsstart
Windowsstart

and select Conductor.

The Start menu is in the lower left corner of your screen.

To speed up the merging process, all text files should be in the same folder. If the files are stored in different folders, copy them into one

Make sure all text files end with a blank line (or a separator character / word / text of your choice) to know where each section starts.

Merge Text (. Txt) Files in Command Prompt Step 2
Merge Text (. Txt) Files in Command Prompt Step 2

Step 2. Open the folder with text files

Click on "This PC" or "Computer" in the right pane, and then browse to the folder with the files. Open the folder - text files will be displayed in the right pane.

Merge Text (. Txt) Files in Command Prompt Step 3
Merge Text (. Txt) Files in Command Prompt Step 3

Step 3. Hold ⇧ Shift and right-click an empty space in the right pane

A context menu will open.

Merge Text (. Txt) Files in Command Prompt Step 4
Merge Text (. Txt) Files in Command Prompt Step 4

Step 4. Click Open Command Prompt

A command prompt window will open with the current directory active.

If you have activated Windows PowerShell, click Open PowerShell Window

Merge Text (. Txt) Files in Command Prompt Step 5
Merge Text (. Txt) Files in Command Prompt Step 5

Step 5. Enter copy *.txt newfile.txt on the command line

Replace "newfile.txt" with the name of the file to be created (for example, mergedfiles.txt).

Merge Text (. Txt) Files in Command Prompt Step 6
Merge Text (. Txt) Files in Command Prompt Step 6

Step 6. Press ↵ Enter to run the command

A new text file will be created with the contents of all text files that are in the current folder.

Popular by topic