More or less anyone using modern PCs has to wonder: why does Windows use backslash as a path separator when the rest of the world uses forward slash? The clear intermediate answer is “because DOS and OS/2 used backslash”. Both Windows 9x and NT were directly or indirectly derived from DOS and OS/2, and certainly inherited much of the DOS cultural landscape.
That, of course, is not much of an answer. The obvious next question is, why did DOS use backslash as a path separator? When DOS 2.0 added support for hierarchical directory structure, it was more than a little influenced by UNIX (or perhaps more specifically XENIX), and using the forward slash as a path separator would have been the logical choice. That’s what everyone can agree on. Beyond that, things get a bit muddled.
A fascinating bit of sleuthing, and the author comes to an interesting theory. What’s fascinating to me is that I don’t even consciously realise the MS-DOS is the odd one out here – I just adapt to it without even thinking about it.
“the rest of the world uses forward slash“
It’s a tiny part of the world but RISC OS uses a full stop.
MacOS used to use full colons for directory separators. You could have forward and backward slashes as part of the file/directory name.
How long ago was that? Did it ever cause compatibility issues for later versions?
That was under “Classic” MacOS. And converting to OSX meant a lot more than just paths had to be changed, so it wasn’t a big deal. It was more “fun” for people interested in interoperability, like transferring files back and forth between Mac and PC, or Mac and Amiga. Transfer utilities generally took care of parsing out the separators and other illegal characters… both ways. They also took care of converting line endings in text files both ways.
Thanks, I didn’t get an opportunity to use an Apple computer until the OS X Intel period.
IIRC, when I still used OS X (up to 2015), there were places where colons as directory separators worked (if it figured out you were doing this, it would automatically swap colons and forward slashes).
But that’s not the first time that Apple had to deal with the swapped conventions – GS/OS swapped them the other direction, from SOS and ProDOS’s forward slashes to Mac colons. IIRC, using slashes didn’t work, and as colons are invalid characters in ProDOS filenames, there was no need to swap colons for forward slashes. (GS/OS also supported HFS, where forward slashes were allowed, but no swapping was needed obviously.)
Oh, and as RISC OS was mentioned up-thread… RISC OS represents periods on foreign filesystems as forward slashes, for the same reason (so you get filenames like NetSurf-3/8/zip). And, RISC OS also has a file type info field in its filesystem, and the convention for storing that on a foreign filesystem is to append an extension using a comma and the three digit hex number that makes up the filetype (so on a remote filesystem, it’s possible to end up with that file being named NetSurf-3.8.zip,ddc, which remote systems really don’t know what to do with automatically).
IBM MVS (mainframe) datasets uses dots. They aren’t really paths, in the common sense of directory structure, but it ends up being used that way.
Yeah, this always pissed me off when using Windows. Thankfully, there are some wonderful scripts that will change a Windows Terminal into a Unix one. As well as support all of your favorite Linux commands like; ls, rm, cp, etc.
Perhpaps to piss off scandinavians that needed to press ctrl-alt- 9 before the advent of altgr key to attain said character. Bill Gates alwayz hated the danes as shown in many sources.
Never heard that, any sources, or times it played in?
I always thought it was because MS-DOS 1.0 only supported a flat namespace for files, so MS (that would’ve been Billg calling the shots in those days) decided to make option switches more intuitive with a forward slash prefix instead of a hyphen. So now filepaths in literal strings in C and many other programming languages need to double each directory separator. A classic example of a UX fail that lives on decades later because changing it at any time would’ve broken compatibility.
astro,
That’s what I think as well. MSDOS 1 didn’t need a separator as it didn’t have sub directories. When it came time to add them, they decided to use backslashes because they were already using forward slashes for commandline switches.
Yeah, exactly. Two other fails from Redmond: 1) when WIndows 3 came out (I think), someone decided to show off the new support for long filenames, including embedded spaces. So they decided to name the root folder of the executables tree C:\Program Files. Which has caused parsing headaches for applications and scripts ever since. 2) 257 characters for a filepath ought to be enough for anybody. Maybe it was during the 1990s, but then people started mapping drive letters to file servers storing source code repositories for entire development teams, among other uses. Meanwhile the Visual Studio team piled on the subdirectories to organize variations in target platform, debug vs. release build, etc. It was rather easy to run into the MAX_PATH limit until Windows 10 took care of the problem just a few years ago. But some of us are still using Windows 7.
Long file names (LFN) support in Windows was released with NT 3.1 (for NTFS), and NT 3.5 (for FAT via the vfat driver). That carried over to Windows 95. AFAICT, Windows 3.x never supported vfat/LFN.
Windows 95 is the one that popularised “C:\Program Files\”, and we’ve been “stuck” with spaces in directory names ever since. I think 95 was also the first one with “C:\Documents and Settings\” which was a royal pain to work with.
Thanks for the correction.
AFAIK the “Documents and Settings” construct first appeared in Windows 2000.
Before that, NT used C:\WINNT\Profiles by default (which was also the convention that Windows 95 adopted for multi-user systems, except C:\Windows\Profiles, of course).
Yeah, I wonder how many hours of productivity have been wasted on the path separator and the CRLF line terminator.
Looks like the original link has been slashdotted (osnewsed?) : wayback has a copy though
https://web.archive.org/web/20190525015342/http://www.os2museum.com/wp/why-does-windows-really-use-backslash-as-path-separator/
The reason is based on dos
abc /parameter1 /parameter2 /parameter3
There was no concept of directories. Your floppy was it. Your system had two floppies.
One floppy for the OS, the other for data