What is the Windows equivalent of the Unix command cat?


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)


Answers:


type

It works across command.com, cmd, and PowerShell (though in the latter it's an alias for Get-Content, so is cat, so you could use either). 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
hi
bye