Coffeehouse Thread

9 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Wierd Windows Behavior

Back to Forum: Coffeehouse
  • User profile image
    codeDebate

    I'm trying to create a new folder with the name con but windows refuses to create it. I tried to create another folder then rename it to con but windows refuses too.

    Guys try it, its really wierd!!!  Perplexed

    I'm using Windows XP SP2

  • User profile image
    irascian

    That IS weird! Perplexed

  • User profile image
    hodo

    'con' is a reserved word in Windows so it will not let you make a folder with that name.

    Same goes for 'aux', 'prn', 'nul', 'com1' ...

  • User profile image
    codeDebate

    hodo wrote:
    'con' is a reserved word in Windows so it will not let you make a folder with that name.

    Same goes for 'aux', 'prn', 'nul', 'com1' ...


    At least it should display an error message, right?!!
    anyways how come reserved words apply on folders, any body can explain this?

  • User profile image
    gaelhatchue

    I would assume that Winsows represents folders, serial ports, and other devices  as "files" just like linux does. That might be a reason.

  • User profile image
    davidvl

    An error message would indeed be better, but this result lies in the base of (MS-)DOS in Windows.

    DOS (like almost any other OS) had a few virtual files in the system. These are indeed (a.o.) the ones HODO lists. These can be written to / read from by applications transparantly (as if it were real files) or users by using the command line.

    I don't really know if these devices/files are still directly accessed this way (by using these logical file names), but since
    - some applications (a.o. from the DOS time but problably some Windows applications too) use it
    - a lot of command line users are used to it
    - it's in the base of the operating system
    it's still there

    See also: http://www.aspheute.com/english/20020131.asp

    Kind regards,

    David van Leerdam

  • User profile image
    NetRyder

    Yeah, this is well-known behavior, and it goes all the way back to the days of DOS.

    Raymond Chen explained the rationale behind it back in 2003:
    http://blogs.msdn.com/oldnewthing/archive/2003/10/22/55388.aspx

    Smiley

  • User profile image
    Cannot​Resolve​Symbol

    Even weirder:

    If you rename a file to con or any of the other reserved words (removing the extension) it will fail silently like you are observing.  But, if you give it an extension, such as con.txt or con.pdf, it will say "Cannot rename xxx:  a file with the name you specified already exists.  Specify a different filename."

    And in Windows 9x, you could have a file called con.txt or anything to that effect-- something to do with the way Windows 95 handled long filenames, I think.

    A relic from the MS-DOS days... only still exists to make batch files and command prompt users happy.  The reserved names are the same concept as linux's device names:  /dev/console, /dev/null, /dev/tty.....  just implemented in an ms-dos-ish way.  And a little bit of information for you to go home with:  NUL is actually still useful if you want to silence the output of a program to the command prompt.

  • User profile image
    vandil

    I fired up my trusty FTP client (Filezilla) and connected to a linux server, created a new folder called con, and downloaded it to 'D:\con'. It worked, but Filezilla doesn't display an icon for it. I can enter it through windows explorer, and create files within it, but if I go to a command prompt, and do a 'cd con', it gives me a 'The system cannot find the path specified.' error. What I find most interesting is that I've never ran in to this problem before.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.