CON is the console character device under MS-DOS and related operating systems, including all forms of Windows. CON is a special, reserved file name.
What this is means is that CON behaves in some ways like a file, but isn't. In particular, data may be written to and read from CON, but CON may not be deleted, created, or renamed. Because of the semantics of character devices, all files whose base name is CON, regardless of extension, are treated identically to CON.
Because of CON's status as a console device file, all data written to it will be output to the console, which is to say the screen (unless the meaning of the console has been changed with CTTY). Attempting to read data from this file will cause data to be taken from the keyboard (same exception applies).
CON has several interesting uses. Because it behaves like a file, it can operate as either the source or destination of the COPY command. Thus, the command
COPY FOO.TXT CON will display the file FOO.TXT. This is equivelent to the DOS
TYPE command. However, both the above
COPY command and
TYPE will not display complete binary files; the former can be modified such:
COPY /B FOO.BIN CON
The above command is the best way to display a complete binary file in DOS without any external tools. The /B flag indicates that the source is a binary file and copying should not stop at an EOF.
Another interesting use of CON with
COPY is nearly the inverse:
COPY CON FOO.TXT will read user input (up until EOF, or control-Z) and deposit it in the file FOO.TXT. This is a simple way to create text files (for example, CONFIG.SYS or AUTOEXEC.BAT) in an emergency situation that may preclude the use of a real editor.
CON is equivelent to /dev/console on Unix systems.
See here for more information on this subject. See also CTTY.