MORE

Display output one screen at a time. MORE can be used to run any executable command (or batch file) and pause the screen output one screen at a time. MORE can also be used to TYPE the contents of any file to the screen.

Syntax
      command | MORE [/E [/C] [/P] [/S] [/Tn] [+n]]

      MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < Pathname

      MORE /E [/C] [/P] [/S] [/Tn] [+n] [Pathname(s)]

Key
   command  Any executable command or batch file.

   Pathname  The file to be displayed. (if more than one separate with spaces).

   /E        Enable extended features.

   /E /C     Clear screen before displaying page.

   /E /P     Expand FormFeed characters.

   /E /S     Squeeze multiple blank lines into a single line.

   /E /Tn    Expand tabs to n spaces (default=8).

   /E +n     Start displaying the first file at line n.

You can create an environment variable called %MORE% and use this to supply any of the above switches.

More will convert any TAB characters to spaces in the output, by default 8 spaces.

If the output of MORE is redirected to a file (MORE demo.txt > output.txt) it will not prompt for the next page, unless the file contains more than 65,536 lines at which point it will prompt for each additional line.

When the output is redirected, this will also redirect/hide the --More (17%) -- prompts.

If extended features are enabled, (/E) the following keystrokes can be used at the -- More -- prompt:

  <space>   Display next page.
  <return>  Display next line.
  Q         Quit.
  P n       Display next n lines.
  S n       Skip next n lines.
  F         Display next file.
  =         Show line number.
  ?         Show help line.

In PowerShell use | Out-Host -Paging in preference to MORE, it will start to yield results immediately through the PowerShell pipeline, without waiting first to collect all the incoming data.

Examples

Convert a Unix text file (LF line endings) to Windows text file (CR/LF)

TYPE UnixFile.txt | MORE /E /P > WindowsFile.txt

Extract just one line from a file: this can be done using FOR /F:

SET "_line12="
FOR /F "skip=11 delims=" %%i in (demo.txt) DO if not defined _line12 set "_line12=%%i"
Echo %_line12%

“less is more” ~ Ludwig Mies van der Rohe

Related commands

TYPE - display files.
ECHO - display variables.
Equivalent bash command (Linux): more / less - Display output one screen at a time.
Equivalent PowerShell: Out-Host -Paging


 
Copyright © 1999-2024 SS64.com
Some rights reserved