Wednesday, November 09, 2005

 

DOS-Reserved Names gotchas

.
A geek discovered that nobody can't create a folder anywhere named as "con" in windows.

This is something pretty cool...and unbelievable... At Microsoft the whole Team, including Bill Gates, couldn't answer why this happened!

Try it out yourself...


This is a forward email I recieved from my friend some days ago. As the word CON is very familiar word to me, I thought of not to overlook the mail. When I read through the mail contents, it is just an anti-Microsoft bigot’s mail.

In those DOS days, the devices are given with constants, like…
CON --> for CONsole output device (that is Video display)
PRN --> for Printer
LPT1, LPT2,… --> for printers (those days Line Printers use these LPT ports)

In the pre-windows age, we use redirectors along with these device constants in our batch scripts. Say for example,

COPY CON filename is to create a new file. What this command doing is, COPYing CONsole contents into a file. All the contents entered after the command will redirected to the file.

Like wise, COPY filename PRN is the command to take a printout of the file.
COPYing the file contents into PRiNter. Similarly, we can use COPY filename LPT1 for printing.

As like in UNIX, we can use these device constants with redirectors and filters.

TYPE filename > CON -->Display the contents of the file into screen.
TYPE filename > PRN --> to take a printout of the file.

Seeing that the device constants are reserved words, we can’t use these words as a file name and they are features of DOS; not a bug.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?