Wednesday, November 7, 2007

Why we can't create con folder?

Why we can’t create con folder?
we cant create a folder(or file) named CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4,
 COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9.

"CON" is for "CONSOLE", which is... the keyboard.

Example: Command using CON

The following COPY command copies what you type at the keyboard to the OUTPUT.TXT file:
 copy con output.txt

After you type this command and press ENTER, MS-DOS copies everything you type to the file OUTPUT.TXT. When you are finished typing, press CTRL+Z to indicate that you want to end the file. The CTRL+Z character will appear on the screen as "Z". You can also end a COPY CON command by pressing the F6 key. When you press F6, it generates the CTRL+Z character, which appears on the screen as Z.
The following example copies information from the keyboard to the printer connected to LPT1:

 copy con lpt1

 

How to create a folder named CON ?

command prompt type mkdir \\.\c:\con will create a folder CON in c:\
See how this works???now try to delete it!!
The reason this is possible is down to UNC naming conventions..by adding the \\ in the statement it makes windows ignore the old DOS command to reserve this folder name.
md \\.\c:\XXX\CON will create a Folder  c:\XXX\ CON

 

No comments: