views:

71

answers:

3

Im curious about the error messages the command prompt returns for the following commands:

C:\>md prn
The directory name is invalid.

C:\>md con
The directory name is invalid.

C:\>md nul

C:\>cd nul
The parameter is incorrect.

Why doesn't "md nul" return an error?

Edit - I understand why this is wrong, what with reserved words and such. I was wondering specifically about the lack of an error message on 'md nul'

A: 

'nul' is a null-device, similar to /dev/null under Linux. It seems that MD (make dir) accepts this name, but ignores any errors about it.

Lekensteyn
That's exactly what he said. He's asking why.
SLaks
+1  A: 

In Windows and DOS, some words might also be reserved and can not be used as filenames.
For example, DOS Device file:

CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9 LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.

Source wiki

codaddict
This doesn't answer the question.
SLaks
A: 

It's probably because CreateDirectory(_T("NUL"), NULL) returns 1 even though it fails to create a directory.

MSN
This is probably the best answer I'm going to get, thanks.
asawyer