How to Use the type Command to View File Contents in Windows 11

The Limitation of Notepad

If you are a systems administrator troubleshooting a broken Windows server, you spend most of your day reading massive text files. Log files, configuration scripts, and error reports are the lifeblood of server diagnostics. If you are using the graphical desktop, you naturally just double-click the file and wait for Notepad to open.

However, what if you are working remotely via a text-based SSH connection, or managing a stripped-down “Server Core” installation that literally does not have a graphical desktop installed? You cannot double-click anything, and you cannot launch Notepad.

To instantly read the internal contents of any text file directly inside the Command Prompt, completely bypassing the need for a graphical text editor, you must use the classic type command.

Step 1: Open the Command Prompt

Because you are only reading files (not altering or deleting them), you can run this command as a standard user, provided you have the security permissions to read the specific file you are targeting.

  1. Press the Windows Key, type cmd.
  2. Press Enter.

Step 2: Viewing a Single File

The syntax for the type command is incredibly simple. You type the command followed by the exact name of the file you want to read.

Assume you are currently in a folder that contains a script named startup.bat.

type startup.bat

The terminal will instantly spit out the entire contents of the file directly onto your screen, allowing you to read the code without ever launching a secondary program.

If the file is located in a completely different folder, you simply provide the full, absolute path to the file.

type C:\Windows\System32\drivers\etc\hosts

This will instantly display the contents of the critical Windows hosts file, which controls local network routing.

Step 3: Handling Massive Files (The Piping Trick)

The type command has one massive flaw: it is dumb. If you ask it to display a server log file that contains 5,000 lines of text, it will instantly dump all 5,000 lines onto your screen in a fraction of a second, leaving you staring at the very bottom of the file.

If you actually need to read the file from the beginning, you must combine the type command with the more command using a mathematical “pipe” (|).

type massive_server_log.txt | more

This tells Windows: “Print the file, but pause the output the exact second the screen fills up.” You can then press the Spacebar to flip through the massive text file one page at a time, allowing you to actually read the data.

Step 4: Combining Multiple Files

The type command possesses a hidden superpower. It can merge the contents of multiple files together simultaneously.

Assume you have three separate text files: monday.txt, tuesday.txt, and wednesday.txt. You want to read all three in chronological order.

type monday.txt tuesday.txt wednesday.txt

The terminal will seamlessly print the contents of Monday, immediately followed by Tuesday, immediately followed by Wednesday. It stitches the data together on your screen.

If you want to permanently merge those three files into a brand new, single master file, you simply use the redirection bracket (>).

type monday.txt tuesday.txt wednesday.txt > complete_week.txt

The command executes silently. If you open complete_week.txt, you will find all three days perfectly stitched together into a single document. By mastering the type command, you gain the ability to rapidly read, diagnose, and merge text data entirely from the command line.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.