4

Possible Duplicate:
Unable to rename a folder or a file as ‘con’

I tried crating a folder with the name CON in Windows, but I couldn't crate it in any of the hard drives.

What could be the reason? Is it possible to create such a folder?

3 Answers 3

10

as previously stated. it's a reserved word from back in MS-DOS, for the CONsole device (as far as i can remember). but, you can force windows/dos to create the folder for you. for devices, it uses the format \\.\[RESERVED_WORD] to access the "file" (these devices used files for communication). to force windows to create your folder, instead of doing mkdir [RESERVED_WORD], do the following:

mkdir \\.\[absolute path to folder of choice, including drive letter]\[RESERVED_WORD]

for example, to create CON folder on my desktop,

mkdir \\.\C:\Users\me\Desktop\CON

to delete the folder, you have to reference it the same way, or else it won't work.

rmdir \\.\C:\Users\me\Desktop\CON

my advice though is to just use a different name. it would be very difficult to always refer to it via its absolute path, especially if you are developing an app you plan on deploying.

9

It's a reserved name from the old MS-DOS days. You couldn't create filenames the same as MS-DOS driver names, and this still stands in today's versions of Windows. See the following Microsoft article for the list of other reserved names.

http://support.microsoft.com/kb/74496/en-us

2
  • "You couldn't create" – and you likely shouldn't. In my school days, when I learnt about those special file names, I tried to input those into various programs certainly not expecting them as user input. Interesting for me, some actually disallow at least those reserved named that I used. Other results were: DO NOT DO THAT! For example, Dungeon Keeper II locks up when fed CON as the save name. So depending on how the file/folder is gonna be used, it may have same ill effects.
    – ZzZombo
    Commented Oct 1, 2018 at 5:30
  • Not requiring the colon on the end... CON: ...seemed like such a good idea at the time. 20/20 hindsight.
    – Eljay
    Commented Oct 3, 2023 at 16:52
2

CON is a reserved name (short for console). Specifying 'con' as a filename for a command line tool will often output data to the screen (if it doesn't just fail, like a lot of .Net apps do). There are a few other reserved names, like AUX for example.