hi...
every one

Can anyone reply me that why can't we take 'con'

as folder name Or any file name....?

Dani AI

Generated

Short answer: because CON (and names like PRN, AUX, NUL, COM1…COM9, LPT1…LPT9, CLOCK$) are reserved device names in the Windows/Win32 namespace. Those strings are treated as special device aliases (CON = console, NUL = null device, COMn/LPTn = serial/parallel ports), so the shell and many Win32 APIs refuse to treat them as ordinary filenames or folder names. (learn.microsoft.com)

Why that exists: the restriction goes back to CP/M and DOS where these identifiers referred to devices rather than files; Windows kept the compatibility semantics so code and scripts that open devices by name still work. pointed to Raymond Chen’s historical notes in the thread; the Microsoft “Naming files, paths, and namespaces” doc explains the Win32 device namespace and why those names are reserved. (en.wikipedia.org)

Workarounds and the risks: people have discovered tricks (command‑line/NT namespace or invisible characters) that make an entry appear named “CON.” One common visual trick inserts a non‑breaking/hidden character so the name isn’t literally CON (it’s e.g. NBSP+CON), which is why it can look normal yet behave oddly. Another approach uses Windows internal path syntax (the “verbatim/NT” namespace) so the system treats the string literally — that can create items that Explorer and many tools can’t open or delete normally. If an unwanted reserved‑name folder appears, tools that understand the literal NT path can remove it; for example an elevated command prompt can remove such a folder with a literal path (example shown here as a deletion pattern only — adapt with the correct drive/path):

rd /s "\\?\C:\full\path\TO\that\CON"

Always be cautious: creating or experimenting with reserved names can leave entries that regular tools can’t handle; avoid doing this on system drives and prefer a different name (for example, con_ or con-folder). (codershelpline.com)

Notes tied to forum posts: correctly listed many of the reserved tokens, and was right that command‑line tricks touch the NT/device namespace — but those tricks are implementation workarounds, not fixes, and are not recommended for normal use. (learn.microsoft.com)

Recommended Answers

All 8 Replies

wow I never new that. Really interesting there is such a big quirk in windows... although not that suprising.

really? lemme try that... oh yeah... its a reserve word for control panel it says...

You can refer this:

Read this amazing fact:-

“An Indian discovered that nobody can’t create a FOLDER anywhere named as “con“. This is something pretty cool….and unbelievable . At Microsoft the whole Team, including Bill Gates, couldn’t answer why this happened!!!”

In Microsoft’s Windows operating systems like Windows XP or in Vista we cant create folders with names CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 directly from GUI. This is because, DOS device names are reserved words, and cannot be used as folder or file names.

Member Avatar for Member #900868

Okay do one thing press Alt and type 255 from NUM keys and then tried to write any one of name from given list : CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 ; and see it happened .
or still confused okay best trick is
1. run>cmd>ok
2. press md\\.\\c:\<dir path>\con
< dir path > is path for making this folder
3. press Enter to make it.

Try to del it .
Is it not deleated , why!!?

[email]KumarUtkarsh@<DaniWEB.com[/email]>

From early DOS command interpreter. We used copy con c:\path bla bla..to enter data or to make it appear that data was coming from "console"

May be 'con' or other words like that only appear to Windows GUI version...

nothing fascinating...
in DOS shell 'copy con' is a command for making a file.
like: "copy con new.txt"
and 'copy' is for copying a folder
so, it is reserved command by its creators to avoid ambiguity.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.