How to echo contents of file in a DOS/Windows command prompt [duplicate]

Possible Duplicate:
How can I print a textfile on the command prompt in Windows?

Like in Unix' cat filename ...
Can this be done?


You can do this with type filename :)


You can cat multiple files like this:

type file1 file2 file3 2>nul

The 2>nul suppresses the output of the filenames. If a file doesn't end with a carriage return, one will not be added between files.

You can do the same thing like this:

copy file1 + file2 + file3 con >nul

In this case the >nul suppresses output of the file names and the n file(s) copied message.


In your command prompt, use the "type" command. You can also pipe it through "more" like in Unix.

  • type filename

...or...

  • type filename | more