CMD Simulator
File Managementtype

TYPE Command – Display File Contents in Windows Command Prompt

Learn how to use the TYPE command to view text file contents in Windows CMD. Complete guide with syntax, examples, and tips for displaying file content.

Rojan Acharya·
Share

The TYPE command is a Windows Command Prompt utility that displays the contents of text files directly in the console without opening an editor, or pipes output to other commands for text processing. Use TYPE to view file contents, combine with redirection to copy or append file contents, or pipe output to commands like FIND, FINDSTR, or MORE for searching, filtering, and pagination—essential for quick file inspection and text processing workflows.

Whether you're a system administrator viewing log files for troubleshooting, a developer inspecting configuration files without launching editors, or a power user verifying file contents before processing, TYPE provides instant text file access from the command line. IT professionals rely on TYPE for log analysis, configuration verification, and automated text processing across enterprise environments.

This comprehensive guide covers TYPE syntax, all usage patterns and redirection options, practical examples for file viewing and text processing, troubleshooting tips for display issues, related text processing commands, and frequently asked questions. By the end, you'll confidently use TYPE for file inspection, text processing, and command-line workflows in Windows environments.

What Is the TYPE Command?

The TYPE command is a file viewing tool in Windows Command Prompt that outputs the entire contents of one or more text files to the console. It's the Windows equivalent of the Unix cat command, providing quick access to file contents without launching a text editor or file viewer.

TYPE works best with plain text files (TXT, LOG, CSV, INI, BAT, CONFIG, XML, JSON) and is available in all Windows versions from MS-DOS through Windows 11, Windows Server 2022, and all enterprise editions. The command displays files exactly as stored, making it ideal for viewing configuration files, log files, scripts, and data files.

The command's simplicity and speed make it invaluable for command-line workflows. System administrators use TYPE to quickly inspect log files during troubleshooting, developers use it to verify configuration files without opening editors, and power users combine it with pipes and redirection for text processing automation.

TYPE vs Text Editors vs MORE

  • TYPE: Displays entire file instantly; no editing; fast for small files; scrolls past for large files
  • Text Editors (Notepad, etc.): Opens in separate window; allows editing; better for large files; graphical interface
  • MORE: Displays file with pagination; pauses after each screen; better for large files; no editing

Use TYPE for quick viewing and piping, editors for editing, and MORE for paginated viewing of large files.

Syntax

TYPE [drive:][path]filename

Parameters

ParameterDescription
[drive:][path]Specifies the drive and directory containing the file (optional)
filenameSpecifies the name of the file to display (required)

No additional parameters: TYPE has a simple syntax with no switches or options. Its power comes from combining with redirection operators (>, >>) and pipes (|).

Multiple files: To display multiple files, run TYPE multiple times or use wildcards in FOR loops.

How to Use TYPE Command

Display a Text File

View the contents of a text file in the current directory:

TYPE readme.txt
TYPE config.ini
TYPE application.log

The entire file contents appear in the console window.

Display a File with Full Path

Specify the complete path to view a file from any location:

TYPE C:\Windows\System32\drivers\etc\hosts
TYPE D:\Projects\App\package.json

Use absolute paths for clarity and reliability in scripts.

Display Multiple Files

Use multiple TYPE commands to view several files sequentially:

TYPE file1.txt
TYPE file2.txt
TYPE file3.txt

Or combine in one line:

TYPE file1.txt & TYPE file2.txt

Redirect Output to Another File

Use > to copy file contents to a new file or >> to append:

TYPE source.txt > destination.txt
TYPE log1.txt >> combined.log
TYPE config.ini >> backup-config.ini
  • > overwrites destination file
  • >> appends to destination file

Pipe Output to Another Command

Combine TYPE with other commands using the pipe operator |:

TYPE data.txt | FIND "error"
TYPE config.ini | FINDSTR "server"
TYPE application.log | MORE
  • | FIND searches for specific text
  • | FINDSTR searches with regex patterns
  • | MORE displays output one screen at a time

Display File with Pagination

Pipe TYPE output to MORE to view large files one screen at a time:

TYPE largefile.txt | MORE
TYPE C:\Windows\System32\drivers\etc\hosts | MORE

Press Space for next page, Enter for next line, Q to quit.

Search Within File Contents

Combine TYPE with FIND or FINDSTR to search files:

TYPE application.log | FIND "ERROR"
TYPE config.xml | FINDSTR "database.*connection"

This displays only lines containing the search term.

Display File to Verify Contents

Use TYPE to verify file contents before or after operations:

COPY source.txt destination.txt
TYPE destination.txt

Confirms the copy operation succeeded and contents are correct.

View Configuration Files

Inspect configuration files without opening editors:

TYPE C:\Windows\System32\drivers\etc\hosts
TYPE app.config
TYPE settings.json

Useful for quick configuration verification or troubleshooting.

Combine Multiple Files

Use TYPE with redirection to concatenate files:

TYPE header.txt > combined.txt
TYPE content.txt >> combined.txt
TYPE footer.txt >> combined.txt

Or use COPY for better file concatenation: COPY header.txt+content.txt+footer.txt combined.txt.

Common Use Cases

  1. View configuration files – Use TYPE to quickly check config files (INI, XML, JSON, YAML) without opening an editor for verification or troubleshooting.

  2. Read log files – Use TYPE to display log file contents for debugging, monitoring, or troubleshooting application issues.

  3. Check file contents – Use TYPE to verify file contents before processing, ensuring files contain expected data.

  4. Combine files – Use TYPE with >> to concatenate multiple text files into a single file for consolidation or archiving.

  5. Search file contents – Use TYPE with FIND or FINDSTR to search within files for specific text, errors, or patterns.

  6. Display system files – Use TYPE to view hosts file, batch scripts, INI files, or other system configuration files.

  7. Verify file encoding – Use TYPE to check if a file is plain text or binary by attempting to display it.

  8. Quick file inspection – Use TYPE for rapid file content viewing during command-line workflows without launching editors.

  9. Pipe to text processing – Use TYPE as input to text processing commands (FIND, FINDSTR, SORT) for automated analysis.

  10. View script contents – Use TYPE to display batch files, PowerShell scripts, or shell scripts for review or debugging.

  11. Display documentation – Use TYPE to view README files, license files, or documentation directly in the console.

  12. Verify file creation – Use TYPE after ECHO or other file creation commands to confirm files were created correctly.

Tips and Best Practices

  1. Quote paths with spaces – Enclose paths containing spaces in double quotes: TYPE "C:\My Documents\file.txt". Without quotes, Windows treats each word as a separate argument.

  2. TYPE displays binary files as garbled text – Use only with text files. For binary files (EXE, DLL, images), use specialized tools like hex editors.

  3. Combine with MORE for pagination – For large files, pipe to MORE: TYPE file.txt | MORE. This pauses output after each screen.

  4. Use TYPE > NUL to test readability – Test if a file is readable without displaying contents: TYPE file.txt > NUL. Useful for error checking in scripts.

  5. Redirect output to create file copies – Use TYPE source.txt > backup.txt to create copies, though COPY is more efficient for this purpose.

  6. Combine multiple files with COPY – For file concatenation, COPY file1.txt+file2.txt combined.txt is more efficient than multiple TYPE commands.

  7. Use FINDSTR with TYPE for pattern matching – Search files with regex: TYPE log.txt | FINDSTR "ERROR.*database". More powerful than FIND.

  8. Check file encoding – TYPE assumes ANSI/ASCII text. For Unicode files, use PowerShell's Get-Content or Notepad for proper display.

  9. Use TYPE in scripts for logging – Display file contents in script output for debugging or audit trails.

  10. Combine with FOR loops – Process multiple files: FOR %f IN (*.txt) DO TYPE "%f". Useful for batch file viewing.

  11. Use TYPE for quick syntax checks – View script or config file contents to check syntax before execution.

  12. Pipe to CLIP for clipboard – Copy file contents to clipboard: TYPE file.txt | CLIP. Useful for pasting into other applications.

Troubleshooting Common Issues

"The system cannot find the file specified" Error

Problem: TYPE displays "The system cannot find the file specified" error.

Cause: The specified file doesn't exist, path is incorrect, or there's a typo in the filename.

Solution:

  • Verify the file exists with DIR filename
  • Check for typos in the filename or path
  • Use Tab completion to auto-complete filenames
  • Enclose paths with spaces in double quotes
  • Use absolute paths for clarity

Prevention: Use DIR to verify files exist before attempting to display them. Copy paths from Explorer to avoid typos.

TYPE Displays Garbled Text

Problem: TYPE shows unreadable, garbled characters instead of text.

Cause: The file is binary (executable, image, compressed) or uses incompatible character encoding (UTF-16, Unicode).

Solution: For binary files, use appropriate tools:

  • Executables/DLLs: Use hex editors or disassemblers
  • Images: Use image viewers
  • Compressed files: Use archive tools

For encoding issues, use PowerShell:

Get-Content file.txt -Encoding UTF8

Prevention: Only use TYPE with plain text files (ANSI/ASCII). Use appropriate tools for binary files or Unicode text.

TYPE Output Scrolls Too Fast

Problem: TYPE output scrolls past before you can read it in large files.

Cause: File is too large to fit on one screen.

Solution: Pipe to MORE for pagination:

TYPE largefile.txt | MORE

Or redirect to a file for leisurely review:

TYPE largefile.txt > output.txt
NOTEPAD output.txt

Prevention: Always use | MORE for large files, or redirect output to files for review at your own pace.

TYPE Doesn't Display Special Characters Correctly

Problem: Special characters, accents, or symbols don't display correctly.

Cause: File uses character encoding incompatible with CMD's code page (usually CP437 or CP1252).

Solution: Change console code page:

CHCP 65001
TYPE file.txt

Code page 65001 is UTF-8. Or use PowerShell:

Get-Content file.txt

Prevention: Use PowerShell's Get-Content for files with international characters or special encoding.

Cannot TYPE Files in Use

Problem: TYPE fails or displays incomplete contents for files in use by other programs.

Cause: File is locked by another process (application, service, or system).

Solution:

  • Close the application using the file
  • Wait for the process to release the file
  • Use administrative privileges if it's a system file
  • For log files actively being written, TYPE may show partial contents—this is normal

Prevention: Close applications before attempting to view their files. For actively written log files, expect partial or incomplete output.

TYPE Shows "Access is denied" Error

Problem: TYPE fails with "Access is denied" when trying to display a file.

Cause: Insufficient permissions to read the file, or the file has restrictive NTFS permissions.

Solution:

  • Run Command Prompt as Administrator for system files
  • Check NTFS permissions with ICACLS filename
  • Verify you have read permissions on the file
  • For network files, ensure you have read access to the share

Prevention: Run CMD as Administrator when viewing system files. Verify permissions before attempting to display restricted files.

Related Commands

MORE – Display Output with Pagination

MORE displays output one screen at a time. Use with TYPE for paginated viewing of large files.

Example:

TYPE largefile.txt | MORE

When to use: Viewing large files that don't fit on one screen.

FIND – Search for Text

FIND searches for specific text in files or command output. Use with TYPE to filter file contents.

Example:

TYPE application.log | FIND "ERROR"

When to use: Finding specific text within files.

FINDSTR – Advanced Text Search

FINDSTR searches for text using regular expressions. More powerful than FIND for pattern matching.

Example:

TYPE config.xml | FINDSTR "server.*port"

When to use: Complex text searches with regex patterns.

COPY – Copy Files

COPY duplicates files. Use to create copies of files you've viewed with TYPE.

Example:

TYPE source.txt
COPY source.txt backup.txt

Integration: Verify file contents with TYPE before copying.

ECHO – Display Text

ECHO displays text or creates files. Use with TYPE to create and verify files.

Example:

ECHO Test content > file.txt
TYPE file.txt

Integration: Create files with ECHO, verify with TYPE.

NOTEPAD – Text Editor

NOTEPAD opens files in the Notepad text editor. Use when you need to edit files after viewing with TYPE.

Example:

TYPE config.ini
NOTEPAD config.ini

When to use: Viewing with TYPE, then editing in Notepad.

Frequently Asked Questions

What does TYPE do if the file doesn't exist?

TYPE displays an error message: "The system cannot find the file specified." The command fails with a non-zero exit code. Use IF EXIST filename TYPE filename in scripts to check before displaying: IF EXIST readme.txt TYPE readme.txt.

Can TYPE display binary files?

TYPE can attempt to display binary files, but the output will be garbled, unreadable characters and beeps. TYPE is designed for plain text files only (TXT, LOG, CSV, INI, BAT, CONFIG). For binary files (EXE, DLL, images), use specialized tools like hex editors or appropriate file viewers.

What is the Windows equivalent of cat?

TYPE is the Windows Command Prompt equivalent of the Unix cat command. Both display file contents to the console. For more advanced features like concatenation, use COPY file1+file2 output or PowerShell's Get-Content. TYPE is simpler but less feature-rich than cat.

How do I display only part of a file?

TYPE displays the entire file. To view specific portions:

  • Pipe to MORE for pagination: TYPE file.txt | MORE
  • Use FIND to filter lines: TYPE file.txt | FIND "keyword"
  • Use PowerShell: Get-Content file.txt -Head 10 (first 10 lines) or -Tail 10 (last 10 lines)

Prevention: Use PowerShell's Get-Content for partial file viewing with -Head or -Tail parameters.

Can TYPE display multiple files at once?

TYPE processes one file at a time. To display multiple files sequentially, run multiple TYPE commands: TYPE file1.txt & TYPE file2.txt. To combine files, use COPY file1.txt+file2.txt combined.txt then TYPE combined.txt. Or use a FOR loop: FOR %f IN (*.txt) DO TYPE %f.

Why does TYPE show strange characters?

Strange characters appear when displaying non-text files (binary, executables, images) or files with incompatible character encodings (UTF-16, Unicode). TYPE assumes ASCII/ANSI text. Solutions: Use appropriate tools for non-text files, or use PowerShell's Get-Content with -Encoding parameter for Unicode files.

How do I copy file contents with TYPE?

Use redirection: TYPE source.txt > destination.txt copies file contents to a new file (overwrites if exists). Use TYPE source.txt >> destination.txt to append to an existing file. However, COPY is more efficient for file duplication: COPY source.txt destination.txt.

Can I use TYPE with wildcards?

TYPE doesn't support wildcards directly. To display multiple files matching a pattern, use a FOR loop: FOR %f IN (*.txt) DO TYPE "%f". This displays all .txt files in the current directory sequentially.

What does TYPE | MORE do?

TYPE file.txt | MORE displays file contents one screen at a time, pausing after each screenful. Press Space for the next page, Enter for the next line, or Q to quit. This is essential for viewing large files that don't fit on one screen.

How do I search within a file using TYPE?

Pipe TYPE output to FIND or FINDSTR: TYPE file.txt | FIND "search term" displays only lines containing "search term". Use FINDSTR for regex: TYPE file.txt | FINDSTR "pattern.*regex". This filters file contents to show only matching lines.

Can TYPE read files from network drives?

Yes, TYPE works with UNC network paths and mapped network drives: TYPE \\server\share\file.txt or TYPE Z:\file.txt for mapped drives. Ensure you have read permissions on the network share. Network file access may be slower than local files.

How do I display a file without line breaks?

TYPE displays files exactly as stored, including line breaks. To remove line breaks, use PowerShell: (Get-Content file.txt) -join ' ' or process with text manipulation tools. TYPE doesn't have options to modify output formatting.

Quick Reference Card

CommandPurposeExample Use Case
TYPE file.txtDisplay file contentsView text file
TYPE file.txt | MOREDisplay with paginationView large file
TYPE file.txt | FIND "error"Search within fileFind errors in logs
TYPE src.txt > dest.txtCopy file contentsDuplicate file
TYPE file.txt >> log.txtAppend to fileCombine files
TYPE config.iniView config fileCheck settings
TYPE C:\path\file.txtDisplay with full pathSpecific location
TYPE file.txt | FINDSTR "pattern"Regex searchAdvanced filtering
TYPE *.txt (in FOR loop)Display multiple filesBatch viewing
TYPE file.txt | CLIPCopy to clipboardPaste elsewhere

Try TYPE Command Now

Ready to practice viewing file contents? Use our Windows Command Simulator to run TYPE commands safely in your browser. No installation required—practice TYPE, piping, redirection, and text processing in a risk-free environment. Perfect for learning, training, or testing command sequences before running them on production systems.

Explore the full Commands Reference for more Windows CMD utilities, including file management (COPY, MOVE, DEL), directory operations (MKDIR, RMDIR, CD), and text processing commands.

Summary

The TYPE command is the essential Windows tool for displaying text file contents in Command Prompt without opening an editor. Use TYPE to quickly view files, combine with redirection operators (>, >>) to copy or append file contents, or pipe output to commands like FIND, FINDSTR, or MORE for text processing and pagination.

TYPE is the Windows equivalent of Unix's cat command, providing instant access to file contents for configuration verification, log analysis, and command-line workflows. Combine with pipes for powerful text processing: TYPE file.txt | FIND "error" searches for errors, TYPE file.txt | MORE provides pagination.

Master TYPE for quick file inspection, text processing automation, and command-line efficiency. Understanding TYPE's simplicity and combining it with other commands enables powerful text processing workflows in Windows environments. For Unicode files or advanced text processing, use PowerShell's Get-Content cmdlet for additional features and encoding support.