in all versions of Windows we are unable to rename a file or a folder name as con unless we use a renaming software. Why a file or a folder can't be renamed as con?

link|improve this question

0% accept rate
feedback

5 Answers

"con" is the name of a system I/O device, the console.

  • con
  • err
  • nul

And a couple others, I think.

In the old days it was common in DOS to create a file (and I still do this occasionally) with:

C:\>copy con foo.txt
I'm typing some text here.
^Z
    1 file(s) copied.
C:\>
link|improve this answer
A minor correction: err is not reserved. The full list of reserved device names is: con, nul, prn, com1..9, and lpt1..9. They are even reserved when used with any extension (e.g. con.txt). – efotinis Dec 23 '09 at 19:52
"unless we use a renaming software" About the quoted part, how do the "renaming software" get around what is essentially an OS limitatiom – Sathya Dec 23 '09 at 19:57
You got me. I'm sceptical that any "renaming software" can even do it. But if it can, I'd be worried about being able to open or even move the file. As you said, the OS is going to take issue with it. – JMD Dec 23 '09 at 20:32
3  
The master list is at msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx 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. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. – shf301 Dec 24 '09 at 17:07
@Sathya, please try this command yourself, as it suffers the same error as the OP's concern about "con": ren foo.txt err. "err" is not a reserved device name, but it is reserved nonetheless. :) – JMD Jan 5 '10 at 16:53
show 2 more comments
feedback

You can rename it without using any special software, just the command prompt:

For example:

C:\>echo Test > \\?\C:\con
C:\>type \\?\C:\con
Test
C:\>rename \\?\C:\con test.txt
C:\>type test.txt
Test

After \\?\ the full path should be specified.

link|improve this answer
feedback

i gave this answer to a duplicate, and thought i'd post it here for your reference:

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.

link|improve this answer
feedback

Just like there are characters that cannot be used in a filename, there are also several words (whole filenames) that cannot be used because they are reserved.

link|improve this answer
feedback

copy con is an archaic (MS-DOS) method of creating a text file. For example:

copy con output.txt

So it is a reserved word and cannot be used as a folder name in Windows.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.