If you want to print the contents of a text file in windows command prompt, more command is very handy. It can print one page at at time, and when user can press ‘Enter’ key to read the next page.
More command can also be used for reading the output of other commands/applications in the console.
Print the contents of a file, one page at a time.
When the above command is executed, you will see one page of text from the file printed in the command window. If the file
has more content to be displayed, you can see the second page by pressing space bar key. You can do so till you reach to the end
of the file. You can exit the command by pressing ‘q’ at any page.
More command can be used to display the output of other commands output in the above fashion. We can use redirection operation (|) for this.
command | more
For example, if you want to run ‘dir‘ command in a directory with large number of files, you can user more command, to look at the list of the files, one page
at a time. The command for this is given below.
dir | more
Advanced options of more command
more /C data.txt
This would clear the current screen text and then would print the contents of the file data.txt
Read file from n+1 th line instead of reading it from the first line:
more +n filename
To skip first 100 lines in data.txt and print data from 101 th line, the command is:
more +100 data.txt