TExcelTAD
Home › Windows CMD & Batch › type & more

type & more

To look inside a text file without opening an editor, CMD has two commands: type prints a whole file to the screen, and more shows long text one screenful at a time. They are the Windows counterparts of cat and less on Linux and macOS.

type: print a file

type prints the contents of a file exactly as it is stored:

cmd · try it yourself
@echo off
mkdir demo & cd demo
(
  echo # Project notes
  echo - fix the login bug
  echo - write release notes
) > notes.md
type notes.md
# Project notes
- fix the login bug
- write release notes

Paths with spaces need quotes: type "C:\Users\ada\My Notes\todo.txt". Unlike Linux's cat, type is only for viewing: it does not accept input from a pipe, and to join files you use copy /b a+b c (see copy, move & ren).

Several files at once

type accepts several names, or a wildcard. Before each file it prints the file name, framed by blank lines:

cmd
C:\Users\ada\demo>type jan.txt feb.txt

jan.txt


sales: 120

feb.txt


sales: 95

Those headers go to the error stream (stderr), not to normal output, so type *.txt > all.txt writes only the contents into all.txt, while the names still appear on the screen. If you want your own headers, loop over the files with for:

cmd · try it yourself
@echo off
mkdir demo & cd demo
> jan.txt echo sales: 120
> feb.txt echo sales: 95
for %%f in (feb.txt jan.txt) do (
  echo ===== %%f =====
  type %%f
)
===== feb.txt =====
sales: 95
===== jan.txt =====
sales: 120

Reading the first line into a variable

A common scripting task is "read the first line of a file". set /p normally reads a line typed by the user, but with < it reads from a file instead:

cmd · try it yourself
@echo off
mkdir demo & cd demo
(
  echo 2.4.1
  echo released 2026-09-30
) > VERSION.txt
set /p version=< VERSION.txt
echo Building version %version%
Building version 2.4.1

To process every line of a file, use for /f, covered in for /f: Parse Text.

more: one screen at a time

When a file is longer than the window, type scrolls the beginning out of sight. more stops after each screenful and shows -- More -- at the bottom:

cmd
C:\Users\ada>more C:\Windows\System32\drivers\etc\hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
...
-- More (42%) --

Keys you can press at the -- More -- prompt:

Key Action
Space next page
Enter next line
q quit
p n show the next n lines
s n skip the next n lines
= show the current line number
? list these keys

more reads from a file name, from a pipe or from < redirection, so these all work:

cmd
C:\Users\ada>more log.txt
C:\Users\ada>type log.txt | more
C:\Users\ada>more < log.txt
C:\Users\ada>dir /s C:\Windows | more
C:\Users\ada>robocopy /? | more

The last two are the classic use: paging through the long output of another command. When more's output is not a console window (redirected to a file or another pipe), it doesn't pause and simply passes the text through:

cmd · try it yourself
@echo off
mkdir demo & cd demo
(
  echo line one
  echo line two
  echo line three
) > lines.txt
type lines.txt | more
line one
line two
line three

Useful more switches

Switch Meaning
+n start at line n (more +10 big.log skips the first 10 lines)
/s squeeze several blank lines into one
/t n expand tabs to n spaces (default 8)
/c clear the screen before each page
/e enable the extended keys above (on by default on modern Windows)

more +n is a handy way to skip a header line:

cmd
C:\Users\ada\demo>type sales.csv
region,amount
north,120
south,95

C:\Users\ada\demo>more +1 sales.csv
north,120
south,95

Note: more expands tab characters into spaces, so a file copied with more < in.txt > out.txt may not be identical to the original. Use copy to duplicate files.

Not for binary files

type and more assume text. Typing a .exe, .zip or image prints random symbols, may beep and can scramble the console. Text files saved as UTF-16 (common for files created by Windows PowerShell 5.1 with >) show correctly with type, but findstr and many other classic tools can't read them.

Command summary

Task CMD PowerShell bash
print a file type f.txt Get-Content f.txt (cat) cat f.txt
page through more f.txt Get-Content f.txt | more less f.txt
first line set /p x=< f.txt Get-Content f.txt -First 1 head -n 1 f.txt
skip header more +1 f.txt Get-Content f.txt | Select-Object -Skip 1 tail -n +2 f.txt

Learn more: Viewing File Contents · Bash cat

Test yourself

Which command shows a long file one screenful at a time?

  1. type /p log.txt
  2. more log.txt
  3. dir /p log.txt
  4. page log.txt

How do you read the first line of VERSION.txt into the variable v?

  1. set v=type VERSION.txt
  2. set /p v=< VERSION.txt
  3. type VERSION.txt > %v%
  4. set /a v=VERSION.txt

With type a.txt b.txt > all.txt, where do the file-name headers go?

  1. Into all.txt
  2. To the screen, because they are written to stderr
  3. Nowhere, type never prints names
  4. Into a.txt