3 ms·
Can anyone explain why was that a problem, from technical point of view? They already had paths starting with "driveletter:", not like unix with just "/". Why w
by r00f 6y ago
Can anyone explain why was that a problem, from technical point of view? They already had paths starting with "driveletter:", not like unix with just "/". Why would it be a problem for parser to distinguish between filepaths and arguments switch?
- skissane 6y agoBecause 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.
- hnick 6y agoPaths can drop the drive letter e.g. del \file will try to delete a file in the root of the current drive. On modern Windows you can use slash, but you have to quote the argument e.g. dir "C:/windows" You can even mix both types together e.g. dir "C:/windows\system32" which is convenient when using code modules that only output unix style paths. No need to clean them up.
- deleted 6y ago[deleted]