CON – Windows CMD Command

CON (short for Console) is an input device, not a command.

After entering any of these commands, type in the text required, note there is no obvious prompt for this, then end the file by typing CTRL-Z, this will insert an EOF marker: ASCII 0x1a (SUB).

When using COPY the CTRL-Z can be placed anywhere, but when using TYPE it is important that the CTRL-Z is only entered at the beginning of a new line, otherwise, it will just be saved into the file and you will have two EOF markers in the same file.

Most basic text editors will stop reading after the first EOF marker.

Some commands e.g. CLS, do not work as expected when redirected to CON and will output extra control characters.

More advanced use of the console device is to redirect the console CON into FIND and then redirect the output from FIND into a file, this will make FIND discard any lines which do not contain the desired text. This can be useful for condensing large log files to return only the lines of interest.

You may also like...

1 Response

  1. zortilonrel says:

    I genuinely enjoy looking through on this site, it has got great articles. “The longing to produce great inspirations didn’t produce anything but more longing.” by Sophie Kerr.

Leave a Reply

Your email address will not be published.