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.
You can find the more command, with different parameters, in the Recovery Console.
<command> | more [/c] [/p] [/s] [/t<n>] [+<n>] more [[/c] [/p] [/s] [/t<n>] [+<n>]] < [<drive>:][<path>]<filename> more [/c] [/p] [/s] [/t<n>] [+<n>] [<files>]
||Specifies a command for which you want to display the output.|
|/c||Clears the screen before displaying a page.|
|/p||Expands form-feed characters.|
|/s||Displays multiple blank lines as a single blank line.|
||Displays tabs as the number of spaces specified by n.|
||Displays the first file, beginning at the line specified by n.|
||Specifies the location and name of a file to display.|
||Specifies a list of files to display. You must separate the files using spaces.|
|/?||Displays help at the command prompt.|
- When you execute the above command, you will see one page of text from the file printed in the command window. If the file
has more content display, you can see the second page by pressing space bar key. You can do so till you reach the end
of the file. You can exit the command by pressing ‘q’ at any page.
You can use the morecommand to display the output of other commands output in the above fashion. We can use redirection operation (|) for this.
- The following subcommands are accepted at the more prompt (
-- More --), including:
TABLE 2 Key Action SPACEBAR Press the SPACEBAR to display the next screen. ENTER Press ENTER to display the file one line at a time. f Press F to display the next file listed on the command line. q Press Q to quit the more command. = Shows the line number. p
Press P to display the next n lines. s
Press S to skip the next n lines. ? Press ? to show the commands available at the more prompt.
- When you use the redirection character (
<), you must also specify a file name as the source.
- If you use the pipe (
|), you can use such commands as dir, sort, and type.
Morecommand 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.
To view the first screen of information of a file named Clients.new, type one of the following commands:
more < clients.new type clients.new | more
The more command displays the first screen of information from Clients.new, and you can press the SPACEBAR to see the next screen of information.
To clear the screen and remove all extra blank lines before displaying the file Clients.new, type one of the following commands:
more /c /s < clients.new type clients.new | more /c /s
To display the current line number at the more prompt, type:
It adds the current line number to the more prompt, as
-- More [Line: 24] --
To display a specific number of lines at the more prompt, type:
The more prompt asks you for the number of lines to display, as follows:
-- More -- Lines:. Type the number of lines to display, and then press ENTER. The screen changes to show only that number of lines.
To skip a specific number of lines at the more prompt, type:
The more prompt asks you for the number of lines to skip, as follows:
-- More -- Lines:. Type the number of lines to skip, and then press ENTER. The screen changes to show that those lines are skipped.