Have you ever noticed that it’s C:\Windows\ in Windows, http://howtogeek.com/ on the web, and /home/user/ on Linux, OS X, and Android? Windows uses backslashes for paths, while everything else seems to use forward slashes.
Modern software tries to automatically correct you when you type the wrong type of slash, so it doesn’t matter which type of slash you use most of the time. But, sometimes, the difference still matters.
Why Windows Uses Backslashes: A History
So why is Windows the odd operating system out? It’s all down to a few accidents of history that happened decades ago.
Unix introduced the forward slash character — that’s the / character — as its directory separator around 1970. We don’t really know why they chose this one, but that’s the one they picked.
It’s hard to imagine today, but the original version of Microsoft DOS — that’s MS-DOS 1.0 — didn’t support directories at all when it was released in 1981. Most of the utilities included with DOS were written by IBM, and they used the / character as a “switch” character. You can still see this today in the command prompt — running the command dir /w tells the dir command to run with the wide list format option, while running the command dir c:\ tells the dir command to list the contents of drive C:\. The different types of slashes here indicate whether you’re specifying an option or a directory path. (On Unix, the – character is used instead of the / character to indicate switches.)
At the time, people didn’t really care that they were using a character that was used for a different purpose on another operating system.
RELATED: Does Windows Still Rely on MS-DOS?
MS-DOS 2.0 introduced support for directories, but IBM wanted to keep compatibility with the original DOS utilities and other programs that expected the / character to be used for switches. Microsoft had already used the / character for something, so they couldn’t just re-use it. They ultimately chose the \ character instead, as it was the most similar-looking character visually.
Windows may not be built on top of DOS anymore, but you can still see the legacy of DOS throughout Windows in the way backslashes and other features like drive letters are used for the file system.
Many of these details are from Microsoft employee Larry Osterman’s blog post on the subject, which contains more detailed inside information from Microsoft employees who made these decisions.
Why Everything Else Uses Forward Slashes
This all wouldn’t really matter today, but web browsers follow the Unix convention and use / characters for web page addresses. A typical Windows user sees a forward slash when they type a web address and a backslash when they type the location of a local folder, so this can be confusing. Websites follow the Unix convention, as do other protocols like FTP. Even if you’re running a web server or FTP server on a Windows machine, they’ll use forward slashes because that’s what the protocol calls for.
Other operating systems use forward slashes for the same reason — it’s the Unix convention. Linux is a Unix-like operating system, so it uses the same type of slash. Mac OS X is based on BSD, another Unix-like operating system. Other consumer operating systems like Android, Chrome OS, and Steam OS are based on Linux, so they use the same type of slash.
Does it Matter?
The more interesting question is whether it really matters. Browser and operating system developers seem to realize that users are confused, so they often go out of their way to accept any type of slash possible. If you type http:\\howtogeek.com\ into Google Chrome, Mozilla Firefox, or Internet Explorer, the browser will automatically correct it to http://howtogeek.com/ and load the website normally. If you type C:/Users/Public into Windows Explorer and press Enter, it will automatically be corrected to C:\Users\Public and you’ll be taken to the correct location.
DOS developers weren’t happy with this even in the early days, so they made DOS accept both types of characters for paths. You can still type commands like cd C:/Windows/ into the Command Prompt today and you’ll be taken to the correct folder.
This doesn’t work everywhere in Windows, however. If you type a path like C:/Users/Public into the Open dialog and press Enter, you’ll see an error saying that the file name isn’t valid. There are other web-based applications that may show you an error if you attempt to type a path like http:\\howtogeek.com\ — it depends whether the program corrects it for you or decides to display an error.
You can usually forget that there are two different types of slashes, but it occasionally does matter. It would be nice if everyone used a consistent separator for directory paths, but Windows has historically been all about backward compatibility — even in the early 1980s.