Mail Archives: djgpp/1997/03/09/10:51:10
On Thu, 6 Mar 1997, Ben Shadwick wrote:
> > Nope, it's "COMx" and "LPTx" (no colons). The short program that I
> > posted in this thread also fails for "LPT1:", but works for "LPT1".
> >
> > Generally, DOS disallows file names with a colon (except as part of
> > d:pathname), so it's not surprising that the colon doesn't work in
> > device names.
>
> That must have to do with DJGPP or something then. Try (from a DOS
> prompt) doing:
> dir > prn
> dir > con
> dir > lpt1:
> dir > lpt1
This example only proves that COMMAND.COM stops parsing the filename
at the first delimiter (colon is a delimiter) when it handles the
redirection syntax. DOS itself has nothing to do with that. That's
why I posted a small test program: using it you can say exactly what
is and what isn't the correct name of the device as far as DOS is
considered.
If you want more proof, try the undocumented command TRUENAME:
C:\DOS> TRUENAME \MSDOS.SYS
C:\MSDOS.SYS
C:\DOS> TRUENAME LPT1
C:/LPT1
C:\DOS> TRUENAME LPT1:
File not found - LPT1:
See? TRUENAME (which is just a wrapper for function 60h of DOS
Interrupt 21h) prints the name of devices with a forward slash whereas
files and directories are printed with backslash. But `LPT1:' (with
the colon) is an illegal name, so TRUENAME fails, although it won't
fail for a non-existing file with legal name, like so:
C:\DOS> TRUENAME XYZZY.FOO
C:\DOS\XYZZY.FOO
- Raw text -