How to Display File Contents in CMD: Complete Guide
Viewing what's inside a file without opening a dedicated application is one of those CMD skills that saves time once you know it exists. Windows Command Prompt offers several built-in commands for reading file contents directly in the terminal — each behaving differently depending on file size, format, and what you actually need to do with the output.
Why Display File Contents in CMD?
Sometimes you need a quick look at a config file, a log, a script, or a plain-text document without launching Notepad or another editor. CMD lets you read files inline, pipe their contents into other commands, or scroll through large files page by page. It's especially useful in automated scripts, remote sessions, or situations where a GUI isn't available.
The key is knowing which command fits the job.
The Main Commands for Viewing File Contents
TYPE — The Simplest Option
The TYPE command is the most straightforward way to display a file's contents in CMD.
type filename.txt It prints the entire file to the terminal in one shot. For small files — config files, batch scripts, short logs — this works perfectly. For large files, the output scrolls past faster than you can read it.
Key behaviors:
- Works on plain-text files (.txt, .log, .csv, .ini, .bat, .cfg, etc.)
- Binary files (executables, images, Office documents) will output garbled characters
- You can view multiple files at once:
type file1.txt file2.txt
MORE — Paginated Reading 📄
When a file is too long to read in one scroll, MORE displays it one screenful at a time.
more filename.txt Press Space to advance a full page, Enter to move one line at a time, and Q to quit. This is the right tool for reading lengthy log files or any text document that exceeds a terminal window's visible height.
You can also pipe TYPE into MORE for the same effect:
type filename.txt | more FIND — Display Lines Containing Specific Text
If you don't want the whole file — just lines matching a keyword — the FIND command filters the output:
find "error" logfile.txt This prints only the lines that contain the word "error." It's case-sensitive by default. Add /I for case-insensitive matching:
find /I "error" logfile.txt FIND is particularly useful when scanning log files for specific events without reading thousands of irrelevant lines.
FINDSTR — Pattern Matching With More Power
FINDSTR is the more advanced sibling of FIND. It supports regular expressions and can search across multiple files simultaneously.
findstr "warning|error" logfile.txt findstr /S "keyword" *.txt The /S flag searches subdirectories recursively — handy when you're not sure which file in a folder contains the text you're looking for.
Comparing the Commands at a Glance
| Command | Best For | Handles Large Files? | Filtering? |
|---|---|---|---|
TYPE | Quick full-file reads | ❌ Scrolls past | No |
MORE | Long files, paginated | ✅ Yes | No |
FIND | Simple keyword search | ✅ Yes | Yes (exact text) |
FINDSTR | Pattern/regex search | ✅ Yes | Yes (advanced) |
Redirecting and Saving Output
Displaying file contents in CMD isn't limited to reading on screen. You can redirect output to another file using > or append it using >>:
type source.txt > copy.txt find "error" logfile.txt >> errors_only.txt This makes these commands useful building blocks in batch scripts and automated workflows — not just one-off reads.
Variables That Change How This Works 🖥️
Not every file-reading scenario plays out the same way. Several factors influence which approach works best:
File encoding matters more than most people expect. TYPE and MORE handle ASCII and UTF-8 plain-text files well. Files encoded in UTF-16 (common in some Windows system logs) may display oddly or show unexpected characters.
File size is a practical constraint. Piping a multi-gigabyte log file through TYPE won't crash your system, but it produces output that's difficult to work with. MORE and FINDSTR are better suited when files grow large.
File type determines readability. CMD commands read raw bytes. Binary files — PDFs, Word documents, images, executables — will display as unreadable symbols. These tools are designed for plain-text formats.
Windows version has minor implications. The core behavior of TYPE, MORE, FIND, and FINDSTR is consistent across modern Windows versions (10 and 11), but behavior in PowerShell environments or Windows Terminal can differ slightly from the classic CMD prompt.
Technical comfort level shapes which command is practical. Someone running a one-time check benefits from TYPE. A developer parsing logs in a script will reach for FINDSTR with flags and regex patterns.
When CMD Isn't the Right Tool
These commands work well for plain-text files in straightforward situations. But if you're working with structured data formats (JSON, XML, large CSVs), binary files, or need to edit rather than just view, other tools — PowerShell's Get-Content, dedicated log viewers, or text editors — offer more capability.
PowerShell's Get-Content in particular gives you more control over encoding, line selection, and object-based output, which matters in scripting contexts where CMD's raw text output creates friction.
The right command depends on what the file contains, how large it is, and what you plan to do with the output once you've seen it.