Programming Field

More - DOS/Command Prompt Reference

Outputs file content or etc. and pauses and prompts when output overflows the screen.

Syntax

more[.com] [<file>] [/E] [/C] [/P] [/S] [/Tn] [+n]
<command-line> | more[.com] [/E] [/C] [/P] [/S] [/Tn] [+n]

Options

<file>

Specifies the file name to print to the screen (More outputs its content). You can specify multiple files. (Wildcards cannot be used.)

If a file name is not specified, More reads standard input (STDIN). (Please see More and pipe/redirection.)

<command-line> With pipe ‘|’ operator, you can control output of command specified in <command-line>.
/E

[Windows XP and later] Enables extensions of More. If enabled, you can input specific commands when More pauses. (Please see Keyboard command in More screen.)

* It seems extensions are enabled without /E.

/C [Windows XP and later] Clears screen before output. (Similar to execute Cls.)
/P [Windows XP and later] Reads form-feed character (0x0C, Ctrl+L) as a page break. More will divide at form-feed character for pagination.
/S [Windows XP and later] Converts multiple empty lines to one line.
/Tn

[Windows XP and later] Specifies tab width (max count of space character replacing tab character). n will be the character count. (You must specify without space between ‘/T’ and ‘n’ such as ‘/T4’.) The tab width is not always equal to space character count; the output is adjusted so that the next character offset is a multiple of the tab width from the beginning of the line.

The tab width will be 8 if you do not specify this option.

[Prior to Windows XP] The tab width is always 8.

+n [Windows XP and later] Skips n lines. (Specifies ‘+’ and number without spaces such as ‘+10’.)

Details

Usage of More

More is often used when reading file content or command output. More will pause output according to screen size, enabling you to read long text file or long output from the program.

When More outputs to the whole screen, More outputs ‘-- More --’ on the last line of the screen. In this status, you can show next screen ([Windows XP and later] next line) by pressing Enter. To stop More process, press Ctrl+C.

More and pipe/redirection

The syntax of More command is simple and you can only use More command to display file content without any other commands. But More command reads stdandard input if you omit <file>, so you can display output per screen by changing input source using pipe (‘|’) or input redirection (‘<’). For example you can use More command as follows:

more < document.txt
foo.exe | more

Keyboard command in More screen

[Windows XP and later] If the extensions of More are enabled (by default?), you can use following commands (key input) during waiting for input with ‘-- More --’.

Command Description
P When pressing P, More displays the prompt for line count. By entering line count and Enter, you can display next lines by the line count.
S When pressing S, More displays the prompt for line count. By entering line count and Enter, you can skip next lines by the line count.
F When specifying multiple files to <file>, exits displaying the current file and displays the next file. If no next file, exits More.
Q Exits More. (Unlike Ctrl+C, the exit code will be 0.)
= Displays the line number of the lowest line.
? Displays the simple help.
Space key Displays next page. (Forwards one screen.)
Return key (Enter) Displays next line.

Samples

Sample 1

more C:\Config.sys
more < C:\Config.sys
type C:\Config.sys | more

Displays content of ‘C:\Config.sys’ and pauses if the content is long. The above three command lines have the same behavior.

Sample 2

gcc.exe --help | more

Executes the program ‘gcc.exe’ with the parameter ‘--help’, and displays its output per screen.