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 a CTRL - Z to indicate 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 ANSI (note any extended characters will be lost)
eg:
TYPE UnicodeFile.txt > ANSIFile.txt

To convert multiple Unicode files to ASCII try this script

@echo off
ren *.txt *.txx
for %%G in (*.txx) do (TYPE %%G >%%~nG.txt)
echo del *.txx

"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
List - Text Display and Search Tool (Win 2K ResKit)
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

Simon Sheppard
SS64.com