Take the 2-minute tour ×

I want to do exactly what unix "cat" does, but on my PC. Is there a simple equivalent command for the Windows command line?

Specifically I want to create a file from all the files of a given type in a folder

In Unix:

cat *fna >all_fna_files.fna

(which joins all the ".fna" text files into one big text file)

share|improve this question

2 Answers 2

From the command shell:

copy a.txt + b.txt + c.txt output.txt

(But that follows the command shells use of control-Z as an end of file marker, so not suitable in some cases).

In PowerShell:

get-content a.txt,b.txt,c.txt | out-file output.txt

and you can control (using -Encoding parameter) the file encoding (which allows transcoding by using different encoding for the read and write).

share|improve this answer
PowerShell aliases cat to Get-Content too. It's designed to accept many basic Linux commands without much, if any, modification. –  Bob Jun 10 '12 at 9:12
Bob, except if switches and options are involved. –  Joey Jun 10 '12 at 16:25
@Richard: Copy /b a + b + c output.txt doesn't check for on Ctrl-Z. Both variants will copy the entire file if there is NO ctrl-Z in the file. –  Tonny Jun 10 '12 at 18:28
Note that you can include wildcards too, the way wildcards work in windows means you won't be messed up by the expansion list not containing a +, so copy [/b] *.fna all_fna_files.fna.. –  Random832 Jun 10 '12 at 22:24
if I recall from an old test I once did, using COPY with /B to concatenate, will ignore CTRL-Z/EOF markers, and will do the concatenation properly! but judging by copy /? you may need to do a lot of /B like it seems maybe after copy, after each src file and after the dest file.. strange. –  barlop Jun 14 '12 at 6:38

The Windows equivalent in command.com, cmd, and other variants is type. From the Wikipedia article (emphasis mine):

In computing, type is a command in various VMS. AmigaDOS, CP/M, DOS, OS/2 and Microsoft Windows command line interpreters (shells) such as COMMAND.COM, cmd.exe, 4DOS/4NT and Windows PowerShell. It is used to display the contents of specified files. It is analogous to the Unix cat command.

C:\>echo hi > a.txt
C:\>echo bye > b.txt
C:\>type a.txt b.txt > c.txt
C:\>type c.txt
share|improve this answer
Cat doesn't really seem much better. –  David Boike Jun 10 '12 at 16:51
@PenguinCoder Why are you blaming MS? Seems to me they simply followed an existing convention from VMS. –  Andy Jun 10 '12 at 17:28
@DavidBoike Although cat is from con_cat_enate AFAIR. –  Mark Hurd Jun 10 '12 at 17:55
@davidboike It is much better because it actually means and stands for what it does: The cat program is a standard Unix utility that concatenates and lists files. The name is an abbreviation of catenate, a synonym of concatenate. Wikipedia Article Can you say the same for the MS-DOS type command?? –  PenguinCoder Jun 10 '12 at 18:21
@PenguinCoder Except type doesn't concatenate files; it just types their contents to the screen. Its the piping in the example that is actually combining the files, not the type command. –  Andy Jun 10 '12 at 19:50

Your Answer


