CON, AUX, COM0-9, LPT0-9, PRN, NUL explanation request.

Acer / Aspire 4736
December 25, 2011 at 02:46:59
Specs: Windows 7 Ultimate 32bit, Intel(R) Core(TM) 2 Duo T6500 @2.1 GHz / 3001 MB RAM
Hello everyone,

Little-bit googling says CON, AUX, COM0-9, LPT0-9, PRN, NUL etc. are device names so any folder cannot be named with those.

but

mkdir \\.\C:\users\%username%\desktop\con
will create a folder named "CON" on the desktop, I have tested it on my win 7 ultimate and it works.

What I wanna know is that what the "\\.\" suffix is actually stands for? what thinks actually happens when a "\\.\" suffix is added to a drive letter? What it dose?

Can any one help please ???

It is enough for a human to live as a human on earth...


See More: CON, AUX, COM0-9, LPT0-9, PRN, NUL explanation request.

Report •

#1
December 26, 2011 at 10:35:48
Hey, someone atlist reply please...

It is enough for a human to live as a human on earth...


Report •

#2
December 26, 2011 at 13:39:08
I Googled "reserved names" for you and this came up:

http://support.microsoft.com/kb/120716

Nigel

Mobo: Asus P7P55D LE
OS: Microsoft Windows 7 Professional OEM
CPU: Core i5 750 @ 2.67 GHz
RAM: Corsair Dominator DHX+ DDR3 1600MH 4GB
GPU: Sapphire 4870 D


Report •

#3
December 28, 2011 at 03:56:22
Thanks Nigel, for your reply,

but this article only says that the suffix "\\.\" bypasses the reserved words check.

What I wanna know is that what the "\\.\" suffix is actually stands for?

What my windows and filesystem actually thinks when a "\\.\" suffix is added to a drive letter? And why?

How it works?

It is enough for a human to live as a human on earth...


Report •

Related Solutions

#4
December 28, 2011 at 19:49:05
I believe that "\\.\" denotes a network path to the computer that it is run on, much like "." refers to the current directory.

Report •

#5
December 29, 2011 at 13:39:44
Hey Judago, I am vary glad to have you again,

yeah like

CD \\.\C:\users\%username%\desktop
and
pushd \\.\C:\users\%username%\desktop
says it is UNC (network) path

But my desktop is not a network location or shared location then how the

md "\\.\C:\users\%username%\desktop\con"
is creating a con etc. folder onto it ???


How the md, rd, ren, del, dir etc. commands are accepting the UNC style path and working, when my hard disk is not any kinda network location ???

Are those commands assuming that my harddisk is a network location ??? (or can I say windows is assuming that ???)

But how windows letting those commands to create files and folders with reserved names ???

Is there any connection of it with the "posix subsystem" built into windows ???

It is enough for a human to live as a human on earth...


Report •

#6
December 29, 2011 at 16:40:56
It's a little confusing I know, but batch tries to be as backwards compatible as possible to earlier versions of DOS. Since DOS dates back to the late '80s some of the backwards compatibility mimics some of the technical limitations of the time.

I'm a little hazy on some of the details but here is how I understand it. DOS treated devices like nul and con as files that existed in every directory. It also had a limited number of file handles("files=x"), using nul in one directory used one file handle. If a script then changed directory and used nul again it would use another file handle. Since file handles were such a limited resource people start hard coding a path to nul(or whatever device) such as "dir > c:\nul" and "copy c:\con test.txt". If windows wanted to be compatible with these scripts it had to allow hard coded paths to these devices that worked as expected.

"\\.\" isn't a true network path just a special case and not all commands support it. This link should shed some light http://msdn.microsoft.com/en-us/lib...


Report •

#7
January 1, 2012 at 03:12:16
Happy new year...

Thank you Judago for your replay,

So, you are saying, Microsoft was implemented it to support hard coding techniques in windows, like your given link reflects it.

So can I say, md, rd, ren, del, dir etc. commands are coded with those APIs that supports direct access, so they are able to make, delete, rename, list files and folders with reserved names ????

your explanation and the link helped me to understand the mater but there still some confusions, the link says "\\.\" bypasses the filesystem. then who monitors ??? The filesystem or the NT namespace components ???

It is enough for a human to live as a human on earth...


Report •

#8
January 1, 2012 at 15:45:06
I'm not really sure to be honest. It's hard to tell what is going on underneath.

Report •

Ask Question