Windows: `Cat` Equivalent – CMD & PowerShell

The cat command in Linux is used to concatenate files and print to a standard output.

The type command is a Windows cat equivalent that works across a command-line prompt (CMD) and a Windows PowerShell.

In this short note i will show how to concatenate files and how to print the contents of a text file to the screen in Windows.

Cool Tip: Windows grep command equivalent in CMD and PowerShell! Read more →

`Cat` in CMD & PowerShell

Print the contents of a text file in CMD or Windows PowerShell (cat a file):

C:\> type file.txt

Create files:

C:\> echo "line from file1" > file1.txt
C:\> echo "line from file2" > file2.txt

Concatenate files:

C:\> type file1.txt file2.txt > result.txt
C:\> type result.txt
line from file1
line from file2

Type: The type command in PowerShell is the alias of the Get-Content command.

2 Replies to “Windows: `Cat` Equivalent – CMD & PowerShell”

  1. I have found this “alternative” unsuitable for concatenating *binary* files, no matter what I do… When trying to concatenate binary archives to a decompression tool in x64 only capable recovery environment, sadly 32-bit builds of “cat” (GNU or BSD) for Win32 Portable Executables are not available.

    This is a problem… It should not be insurmountable, but I don’t feel proficient enough to cleanly port GNU / BSD “cat”, and “type” seems not to be the answer. (unless you only care about text, in which case “fill your boots”)

  2. The article is incorrect.
    Type and get-Contents are specifically text based and will fail if they hit certain characters.

    copy file con:

Leave a Reply