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.

The only thing that is clear is that Microsoft and IBM were responsible for using the backslash as path separator in DOS 2.0. Microsoft reportedly wanted to use the forward slash as path separator, but IBM nixed the idea because it would have created an incompatibility with DOS 1.x, which already used the forward slash as a switch character, separating command options.

Microsoft old-timers all agree that IBM was strongly against changing the forward slash as a switch character. They are less clear on where that particular slash usage had come from.

There are silly theories about it, like “the slash came from CP/M”. Well, it didn’t. There is no real evidence that CP/M used the forward slash anywhere except the name of the product. Most CP/M commands had no options at all. Third party CP/M tools (such as Micrsoft’s) may well have used slashes, but not the OS itself.

There is obvious nonsense like “CP/M got the slash from VMS”, which is simply not possible because CP/M is older than VMS, and CP/M did not use the forward slash anyway.

SCP’s 86-DOS likewise did not use the forward slash. Which means DOS did not inherit the forward slash from its direct or indirect predecessors (86-DOS and CP/M). It must have come from somewhere else. Can we find out where from?

In fact even PC DOS 1.0 (1981) used the forward slash very, very little. The FORMAT command had the /S option to copy system files, and LINK had a /P option to pause before writing the resulting executable, so that floppies could be swapped. That was it.

Notably LINK and FORMAT were both written by Microsoft. An important point is that PC DOS 1.0 did use forward slashes as option separators upon release.

PC DOS 1.1 (1982) significantly increased the use of the forward slash. COPY had the /A, /B, and /V switches, DIR had /P and /W switches, while DISCKOMP, DISKCOPY, and FORMAT now had a /1 switch (for one-sided floppy operation). The linker likewise had new options such as /DSALLOCATION, /HIGH, /LINE, /MAP, /PAUSE, and /STACK.

That kind of forward slash usage was no doubt why IBM insisted on keeping it in DOS 2.0. Changing the slash semantics had a clear potential for destroying data, especially when running batch files written for DOS 1.1. Something like ‘COPY FOO + BAR /A’ has rather different semantics when /A is a switch vs. when /A is a file or directory in the disk’s root directory.

In retrospect it seems silly to change the path separator in order to preserve backward compatibility with a short-lived early PC operating system, but hindsight is 20/20 and in 1982, the future popularity of UNIX and DOS (and its derivatives) was incredibly non-obvious.

At any rate, it’s clear that DOS used the forward slash since version 1.0, even though its immediate predecessors, CP/M and 86-DOS, did not. So where did it come from? Manuals for old Microsoft language products provide a very good hint. Microsoft’s tools for the 8080 (F80 FORTRAN compiler, M80 macro assembler, LINK 8080 linker all used the forward slash as a switch character separating command line options, and did so at least as far back as 1977. In other words, Microsoft used slash as a switch character before the 8086 even existed, and continued using it for 8086-based tools.

Did Microsoft invent the slash usage? Of course not. A good hint was provided on Larry Osterman’s blog by Hans Spiller, an old time Microsoft compiler author. Even that hint looks wrong, because the claimed history was DEC TOPS-10 to CP/M to DOS, even though CP/M itself did not use the slash. But TOPS-10 sure did use the slash. And a lot more.

In his Computer Connections memoir, Gary Kildall claimed (page 26) that Bill Gates and Paul Allen used a DEC PDP-10 timesharing system, almost certainly running TOPS-10, after stealing other users’ passwords (because the OS recycled memory pages used by other users without scrubbing them, leaving information including plaintext passwords behind).

Microsoft’s own MS-DOS Encyclopedia (1988) mentions that Marc McDonald, an early Microsoft employee, developed an 8-bit multitasking OS called M-DOS, which was “modeled after the DEC TOPS-10 operating system”. Further on, the same book explicitly says that “version 1.x of MS-DOS, borrowing from the tradition of DEC operating systems, already used the forward slash for switches in the command line”.

There we have Microsoft’s own word that the forward slash came not from CP/M, not from IBM, but from DEC, and there’s an explicit mention of TOPS-10. Can we find supporting evidence?

It’s TOPS-10!

The DEC TOPS-10 goes back to the late 1960s and is certainly old enough that CP/M and DOS could have been influenced by it. UNIX, on the other hand, is not quite old enough to have had much influence on CP/M at all, because both were developed more or less at the same time, in the early 1970s. While UNIX was a strong influence on DOS 2.0, there is little evidence that it influenced DOS 1.x in any way at all (while CP/M was a very major influence, obviously).

The DEC PDP-10 mainframe appeared in 1966, and since 1970 it was marketed as DECsystem-10, running the TOPS-10 operating system. The PDP-10 with TOPS-10 was perhaps the first widely used time-sharing system, and it was used by many universities in the 1970s. As such, many early Microsofties, likely including Gates and Allen, would have been familiar with TOPS-10.

Nowadays it is easy to find a TOPS-10 manual, and browsing through it is quite a revelation. Here’s a short example (page 2-220):

.DIR PROG PROG FOR 1 <055> 10-SEP-79 DSKC: [27,5434] PROG REL 1 <055> 10-SEP-79 PROG EXE 68 <055> 10-SEP-79 TOTAL OF 131 BLOCKS IN 5 FILES ON DSKC: [27,5434]

The DIR command lists directory contents. File names have a fixed length and a three-character extension. Executables have an .EXE extension. Disk names have a colon at the end. That looks a lot like DOS and nothing like UNIX.

Note that the odd numbers in square brackets are the TOPS-10 way of specifying directories. Good thing DOS didn’t adopt that one. Also note that DOS replicates the non-obvious behavior where ‘DIR PROG’ is the equivalent of ‘DIR PROG.*’ and will list files with any extension. That’s very unlikely to be a coincidence.

The list of TOPS-10 standard file extensions (appendix D in the manual) brings a lot of DOS memories. The .EXE extension for executables is just the first; there is .OBJ for object files, .SYM for symbol files, .CRF for cross-reference files, .SYS for system files, .BAS for BASIC source files, or .TXT for ASCII text files. Again, these file extensions are very much like DOS and not at all like UNIX.

The TOPS-10 macro assembler also used the IRP macro construct which is known from MASM, but not used by other assemblers (notably Intel’s ASM86 has quite different macro syntax). It is extremely likely Microsoft found the inspiration for MASM in DEC’s assembler.

Case Closed?

Only Microsoft old-timers could probably answer these questions, with the huge caveat that human memories tend to be less than reliable after 40 years. However, there is historical evidence that Microsoft used TOPS-10, very strong circumstantial evidence that several aspects of DOS were influenced by TOPS-10 (including the use of a forward slash as a option separator), and a clear statement in the MS-DOS Encyclopedia saying that the forward slash usage came from DEC operating systems, including mentions of TOPS-10.

It is probably fair to say that Windows today uses backslash as a path separator because 50 years ago, TOPS-10 used forward slash as an option separator.

Update: After posting this article, I realized that although it gives a good explanation of why DOS did not use the forward slash as path separator, it is vague on why backslash was used instead. The answer is the IBM Model F keyboard. The visual similarity of the forward slash and backslash likely played some role, but the deciding factor was ergonomics.

The path separator needed to be a key that does not require Shift to type and that did not already have established use (such as the dot, comma, or semicolon keys, many of which were used by Microsoft language tools). The backtick (`) may have been the only other key available, and given the choice a backslash makes a lot more sense.

The ergonomics of non-US keyboards were naturally not considered, which caused the path separator to be ridiculously difficult to type on some national keyboards (e.g. German), perhaps as a perverse reminder that ergonomics do matter.