3 ms·
Because paths don't have to start with a drive letter – a path like \foo\bar is relative to the current drive. "DIR \W" does a DIR of the "\W" directory on the
by skissane 6y ago
Because paths don't have to start with a drive letter – a path like \foo\bar is relative to the current drive.
"DIR \W" does a DIR of the "\W" directory on the current drive.
"DIR /W" does a DIR listing in wide format.
- r00f 6y agoI see, didn't know that
- pjc50 6y agoYes, and this is absolutely maddening when trying to do cross-platform work because some programs support / in filenames while others interpret them as arguments. (Another key difference is that on UNIX the shell expands '*' before passing it to a program, but CMD doesn't so each program has to do its own globbing)
- ynik 6y agoPretty much all Windows programs support / in filenames. The main issue is some cmd builtins like mkdir/cd/del which have weird parsing rules where every / is interpreted as starting a command-line switch, even if not preceded by a space. But even there, you only need to use quotes (mkdir "c:/test") to suppress the interpretation as a switch and then you can use paths with slashes just fine in batch files.
- kijin 6y agoEven worse, there was (and still is) no requirement for a command and its switches to be separated with whitespace. "DIR/W" is the same as "DIR /W". Which would have made it impossible to determine whether you want to invoke the command "DIR" in the current directory, or the command "W" in a subdirectory named "DIR".
- bregma 6y agoThe DEC operating systems (eg. RSX with its MCR shell and VMS with its DCL shell) also handled command-line switches this way (eg. PIP/LIST to list files in a directory). Of course, they didn't use unixy paths for directories. A fully-qualified file name would be something like (and it's been decades so if I get it wrong forgive me) DRA0:[SYS.USERS.BREGMA.PROJECT.SOURCES]HELLO.C;1 and anyone who was sane would use logical names in DCL to make things readable.