Rather than merely trying to copy the way MS did/does things regarding IF EXIST 
X:NUL, I think we can discuss what the "right" way to handle things should be.

NUL is a device, not a file, though it can sort of look like it is a file in 
some circumstances.  In at least a sense, any device (NUL or CON or whatever) 
is a "file" (or at least a file name) that exists everywhere -- on every disk 
and directory there is, be it networked or removable or whatever (BTW, this is 
different than how *nix handles things).  This concept is much more obvious 
when you don't try and put a disk and/or directory name in front of the NUL -- 
no matter where you are, you can tell DOS to send something the NUL (or any 
other) device and DOS knows "where" it is.  You can either think of it as being 
"an extension of the DOS kernel" or being "inside every drive and directory 
that DOS can see."  Of course, neither analogy is quite correct, but you can 
sort of think of it in those terms.

To DOS, the device variously called NUL, NUL: (with a colon), and C:\NUL always 
exist (if C:\ exists, so does C:\NUL).  If you want to refer to a _file_ called 
C:\NUL instead of the NUL device, you need to put a period at the end (C:\NUL.) 
to explicitly tell DOS you're talking about a file (with no extension) instead 
of a device.  You can also put a colon at the end (C:\NUL:) to explicitly tell 
DOS you are referring to the device called NUL (even if the C:\NUL. file 
exists).  

That's my understanding of how it is _supposed_ to work, anyway, even if it 
doesn't always do that.


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to