5 ms·
The bit about allowing / as a path separator is one of my favorite bits of DOS/Windows trivia. As a unix guy it's fun to give a windows person a path with the s
by throwaway09223 3y ago
The bit about allowing / as a path separator is one of my favorite bits of DOS/Windows trivia. As a unix guy it's fun to give a windows person a path with the slashes wrong like "z:/foo/bar", being corrected for a unix-ism, then having it actually work!
In practice I think the biggest problem with using forward slashes on Windows is confusing programs which expect "/" to indicate program switches. The non-uniformity of shell parsing is also a big unix/win design difference.
- naikrovek 3y agoyeah almost no one knows that forward slashes have been acceptable as path separators since (I wanna say) Win95. perhaps MSDOS.
- throwaway09223 3y agoIt actually predates MSDOS, and I believe dates back to PCDOS 2 when support for directories was first added.
- zwieback 3y agoI'd qualify that as "almost no non-programmers know". Forward slashes are so useful in languages that use \ as an escape sequence that most programmers do know this.
- layer8 3y agoIt doesn’t work everywhere. For example tab completion in cmd.exe doesn’t work for a path containing forward slashes (even when quoted), because forward slash is the prefix character for command-line options.
- naikrovek 3y agoright but that's a cmd.exe thing, not a Windows thing. Windows supports it, CMD doesn't. programs that you run from a CMD prompt support other options flag syntaxes, so it's just a cmd.exe feature. CMD.exe is its own thing with its own backwards compatibility requirements and the case could be made that cmd.exe is "Windows" as much as anything else is, so I get it.
- layer8 3y agoThe point is, you can’t just blindly use forward-slash as a file system path separator everywhere on Windows. It’s not on equal footing with backslash in that respect. As another example, you can’t use forward slashes in the File Open dialog of Visual Studio: https://developercommunity.visualstudio.com/t/allow-forward-slashes-in-file-paths-in-file-open-d/376371 https://developercommunity.visualstudio.com/t/allow-forward-...
- throwaway09223 3y agoThat's incorrect. You're confusing totally separate issues by examining specific pieces of software with product specific bugs. This isn't a valid way to examine the issue: by this metric, spaces aren't supported on unix because many programs choke on them. In fact, you can use forward slashes across the entire file API on Windows. That's the point.
- layer8 3y agoI'm viewing this from the end user's perspective. They can use backslashes everywhere as a path separator, but they can't use forward slashes everywhere. In that sense, forward slashes are in practice a second-class citizen on Windows. The canonical path syntax is and will remain with backslashes.
- chungy 3y agoSince MS-DOS 2.0.
- ambicapter 3y agoCan you mix the two in one filepath though? '/' and '\\'?
- deleted 3y ago[deleted]
- layer8 3y agoYes. You can even write stuff like “cd foo/\bar\/baz”.
- levidos 3y agoDepends on the interpreter, batch and PowerShell accepts both.
- ambicapter 3y agoI had to double-check, but I ran into some issues at work where .Net Framework got confused if I used both separators in a path and used ".." to try to access the parent directory.