TYPE

Display the contents of one or more text files, convert Unicode to ANSI.

Syntax
      TYPE [drive:]pathname(s)

If more than one file is specified the filenames are included in the output.
If a wildcard is used the filenames are not displayed.

Output can be redirected into a new file:

TYPE file.txt > Newfile.txt

Output can be appended to an existing file:

TYPE file.txt >> ExistingFile.txt

To do the same with user console input :

TYPE CON > Newfile.txt

This will require typing a CTRL-Z to indicate the end of file.

When using redirection to SORT a file the TYPE command is used implicitly
For example:

SORT < MyFile.txt

Create an empty (zero byte) file:
TYPE nul >filename.log

If you TYPE a Unicode text file, the output will be Ascii (Windows1252). This behaviour is more a limitation of the CMD shell than a designed feature, any extended characters will be discarded. To work with Unicode files use PowerShell.
eg:
TYPE UnicodeFile.txt > Ascii.txt

“Writing is easy; all you do is sit staring at a blank sheet of paper until the drops of blood form on your forehead” - Gene Fowler

Related:

FOR /F
SORT
Powershell: Get-Content - Get content from item (cat / type / gc)
Equivalent bash command (Linux): cat - Display the contents of a file



Back to the Top

© Copyright SS64.com 1999-2011
Some rights reserved