开发者

command prompt error messges for md 'prn', 'con', and 'nul'

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

C:\>md prn
The d开发者_JAVA百科irectory 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'


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


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


'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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜