Using TYPE to create and edit text files

TYPE is a command that can output the contents of a text file. The output of TYPE can then be used to modify other files, which can be used in batch files.

To display the contents of a text file (Old.bat) with TYPE:

TYPE Old.bat | MORE

To create a copy of a file (Old.bat) to or overwrite an existing (New.bat):

TYPE Old.bat > New.bat

To append the contents of one file (Old.bat) to another file (New.bat):

TYPE Old.bat >> New.bat

To create an empty file:

TYPE nul > New.bat

Remember though that it will only work with text-files, not with binary files.

Related Using ECHO to modify text files.

Updated: 2 July 2007

Tags:
Category:

Leave a Reply

Your email address will not be published. Required fields are marked *