Windows and renaming folders, the 'con' issue

Viewed 39666

Why in Windows, can't you name a folder 'con'?

Whenever I try to name a folder as "con" (without the quotes) it defaults to its original name.

Why does it do this?

5 Answers

Back in the MS-DOS days, "con" had a special meaning. It referred to the console, and allowed you to treat it like any other file. For example, you might create a new text file by typing copy con new.txt. Then you could enter your text and hit ^Z when finished.

The thing is, you can still do that. Therefore, as far as the file system is concerned there is already an object out there named con. There are other reserved names as well, but I see that while typing this those names have been provided already in other answers.

Do not use the following reserved device names for the name of a file:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9

Source: MSDN

Other names, such as drive names, cannot be used as well:

CLOCK$, A:-Z:

Source: Microsoft support

Actually you can rename the folder to con

use this in the command prompt and this creates a system folder named con on your C: Drive

md \\\\\.\\\C:\con

to remove this folder you need to use this in the command prompt

rd/s \\\\.\\\C:\con

And just for those that are wondering "so why would you?" - my name is CON and if I wish to use that as my folder I WILL so "bugger you MS"

Con "OzDing"

This dates back to MS-DOS. Reading or writing to a file named "CON:" read/wrote from the console. I imagine Windows is still supporting this for backwards compatibility.

From Microsoft TechNet:

Several special file names are reserved by the system and cannot be used for files or folders:

CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL

Related