Type command

Updated: 11/12/2023 by Computer Hope
type command

The type command displays the contents of a text file. However, it does not allow you to edit the file, or add new text. To edit a text a file, use Notepad instead. Or, to append text to a new or existing file from the command prompt, use copy con.

Availability

Type is an internal command that is available in the command line of all Microsoft operating systems.

Type syntax

type [drive:][path]filename

The type command has no options.

Filename is the name of the file to show.

If no path is specified, the file must exist in the current directory. If no drive is specified, the file must exist on the current disk drive.

Type examples

type c:\autoexec.bat

Display the file's contents C:\autoexec.bat, if it exists.

type myfile.txt

Display the contents of myfile.txt, if it exists in the current directory.

type "My file.txt"

In this command, the file name contains a space, so it is enclosed in double-quotes.

type "C:\Users\Jeff\Desktop\My files\My notes.txt" | more

Display the file's contents C:\Users\Jeff\Desktop\My files\My notes.txt. Here, the type command is piped ( | ) to the more command that pauses the display after each screen of output, making it easier to view long files.