How do I display the contents of a file in command prompt?

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.

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:

C:\>type d:\countries.txt China USA France Poland Sweden Japan Australia C:\>

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 line

Jun 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 :

How do I display the contents of a file in command prompt?

How do I display the contents of a file in command prompt?

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.

How do I display the contents of a file in 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 filename

This 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

How do you display the contents of a text file?

You can display the contents of a file using the cat command, which stands for concatenate. Let's say we have a file on our Desktop called myFile. txt, which contains the words one through fifteen (i.e., one, two, three…

How do I view the contents of a folder in command prompt?

Click in the address bar and replace the file path by typing cmd then press Enter. This should open a black and white command prompt displaying the above file path. Type dir /A:D. /B > FolderList.

How do I show the contents of a file in Terminal?

Cat is a popular and straightforward command for listing the contents of a file to the terminal. You can pass the absolute path to the file, as shown in the example above. Cat is simple yet powerful when used with other options. To learn how to use the cat command, read -> how to use the cat command.