Windows command type command

Share on facebook
Share on google
Share on twitter
Share on linkedin

type

TYPE (DOS command) - Wikipedia

 

 

In the Windows Command shell, they built-in the type command which displays the contents of a text file. Use the type command to view a text file without modifying it.

In PowerShell, type appears as a built-in alias to the Get-Content cmdlet, which also displays the contents of a file, but using a different syntax.

The Get-Content cmdlet gets the content of the item at the location specified by the path, such as the text in a file or the content of a function. For files, the content is read one line at a time and returns a collection of objects, each of which represents a line of content.

Beginning in PowerShell 3.0, Get-Content can also get a specified number of lines from the beginning or end of an item.

Syntax

type [<drive>:][<path>]<filename>

Parameters

PARAMETERS
Parameter Description
[<drive>:][<path>]<filename> Specifies the location and name of the file or files that you want to view. If your <filename> contains spaces, you must enclose it in quotation marks (for example, “Filename Containing Spaces.txt”). You can also add multiple filenames by adding spaces between them.
/? Displays help at the command prompt.

Remarks

  • If you display a binary file or a file that is created by a program, you may see strange characters on the screen, including formfeed characters and escape-sequence symbols. These characters represent control codes that are used in the binary file. In general, avoid using the type command to display binary files.

Examples

To display the contents of a file named holiday.mar, type:

type holiday.mar

To display the contents of a lengthy file named holiday.mar one screen at a time, type:

type holiday.mar | more

In the Windows Command shell, they built-in the type command which displays the contents of a text file. Use the type command to view a text file without modifying it.

In PowerShell, type appears as a built-in alias to the Get-Content cmdlet, which also displays the contents of a file, but using a different syntax.

The Get-Content cmdlet gets the content of the item at the location specified by the path, such as the text in a file or the content of a function. For files, the content is read one line at a time and returns a collection of objects, each of which represents a line of content.

Beginning in PowerShell 3.0, Get-Content can also get a specified number of lines from the beginning or end of an item.