Type

Index

The TYPE command is used to display the contents of an ASCII text file on screen.

Syntax:

TYPE filename

Notes:

  1. To display text files one screen at a time, pipe the output from a TYPE command to MORE.

  2. To modify a text file, search for a particular word, or move from one page to another and back, use Notepad in Windows95 or EDIT in Dos.

  3. TYPE is primarily used:
    • to display formatted text on the screen during the running of a batch file. This could be a menu leading up to a CHOICE command, or a warning/advice before proceeding with some operation. Although slightly slower to display than using ECHO, it is much easier to edit a text file than a series of ECHO statements.
    • to feed the contents of a text file into a command using redirection.

Examples:

  1. To display the contents of HOLIDAY.MAR:
    TYPE holiday.mar

  2. If the file is too long to fit on a single screen:
    TYPE holiday.mar | MORE

  3. To pipe the contents of GO.TXT to a DEL command requiring confirmation before deleting all files in a directory.
    TYPE go.text | DEL *.*
    If the first two characters of GO.TXT contain a "Y" or "y" followed by an [Enter], the files will be deleted. Anything else and the operation will be skipped.

File Details:

Internal


If you should have any comments or suggestions,
please contact: Bob Watson
.
This page last revised:
August 27, 2000.