You can cat multiple files like this:
type file1 file2 file3 2>nulThe 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 >nulIn this case the >nul suppresses output of the file names and the n file[s] copied message.
If you want to read a file using the Windows CMD command and print it on the console, you can make use of the type command,
Type: Displays the contents of a text file or files.Syntax: TYPE [drive:][path] filename
Example:
If the file is too huge then type command will keep on buffering the text on the console, in such a case you can make use of more command,
C:\>more d:\countries.txt China USA France Poland Sweden Japan Australia India Nepal Bhutan Sri Lanka Germany Canada -- More [78%] --More command Windows CMD
C:\>help more Displays output one screen at a time. MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < [drive:][path]filename command-name | MORE [/E [/C] [/P] [/S] [/Tn] [+n]] MORE /E [/C] [/P] [/S] [/Tn] [+n] [files] [drive:][path]filename Specifies a file to display one the screen at a time. command-name Specifies a command whose output will be displayed. /E Enable extended features /C Clear screen before displaying page /P Expand FormFeed characters /S Squeeze multiple blank lines into a single line /Tn Expand tabs to n spaces [default 8] Switches can be present in the MORE environment variable. +n Start displaying the first file at line n files List of files to be displayed. Files in the list are separated by blanks. If extended features are enabled, the following commands are accepted at the -- More -- prompt: P n Display next n lines S n Skip next n lines F Display next file Q Quit = Show line number ? Show help line Display next page Display next lineJun 8th, 2012 · Comments Off on Quickly View File Contents Using Windows Command Prompt
It is possible to view contents of any file directly using the Windows command prompt.
To do this :
1. Open Windows command prompt [Windows orb > in search box, type “command prompt” or All Programs > Accessories > Command Prompt].
2. Simply type the following :
This will display the contents of file specified. [Ensure that the correct file path is specified, like – type “D:\drafts\today.txt” ]
Pretty handy when viewing log files as well as text files, all from within the Windows command prompt.
on January 1, 2009
We can read a text file from command line using type command. This command is similar to cat command on Linux.
Example: Let us print the contents of the file c:\boot.ini
C:\>type c:\boot.ini [boot loader] timeout=30 default=multi[0]disk[0]rdisk[0]partition[2]\WINDOWS [operating systems] multi[0]disk[0]rdisk[0]partition[2]\WINDOWS="Microsoft Windows XP Home Edition"If the file is very huge, we can use more command to read the data one page at a time. This more command is pretty much similar to the Linux more command.
Syntax of the command is:
more filenameThis command prints one page text on the console and waits for the user to press Enter before it shows the next page.
The above explained commands work in Windows 7, Windows 10 and all Server editions