Jun 05 2007

Reserved filename in Windows

Category: Software DevelopmentDmitry @ 6:21 pm

I just found out, you can’t create a file/directory named “con” on windows. I thought I was going crazy for a second there.

Just try it! It won’t work. Does anyone know why though?

6 Responses to “Reserved filename in Windows”

  1. Daniel Burke says:

    Sorry I should elaborate upon that, the idea was that if you were in a really dire situation in dos you could cobble the system together with something like…
    C:\>copy con autoexec.bat
    @echo off
    prompt $p$g
    lh mouse
    (then press [f6] or [ctrl]+[z] to generate the “Z^”, and press [enter])

    And it would create a text file. So as long as you still had command.com, you could always print, create and read text files. Saved my hide more than once.
    Also you could type “copy con prn” to turn your computer into an overpriced typewriter :-p

  2. Dmitry says:

    Thanks!

  3. Paramjit says:

    con is reserved for console which means your keyboard and monitor.
    try:
    C:\> copy filename con:
    this will display the contents of the file.

  4. Michael Hendrickx says:

    There are a few reserved keywords. con, prn, aux. It’s what caused the con/con DoS back in the 90’s :)

  5. afdzal3 says:

    The other keyword that you can’t create the folder with are: -

    PRN- refers printer
    NIL - refers void
    AUX - refers to the auxilary device
    COM1 - COM 1 port
    COM2 - COM 2 port
    COM3 - COM 3 port
    COM4 - COM 4 port
    LPT1 - LPT 1 port
    LPT2 - LPT 2 port
    LPT3 - LPT 3 port
    etc …

  6. Dmitry says:

    awesome! thanks guys

Leave a Reply