Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Why does Windows use backslashes for paths and Unix forward slashes?

What is the main difference between forward slash (/) and backslash (\) in reference to paths, both remote and local?

If I recall correctly, backslash is used to denote something within the current computer or network such as C:\Windows or \\172.12.1.34, while forward slashes are used to denote something that is outside or external to the current computer or network such as http://www.google.com/.

I would like to know if this is an accurate explanation or if the difference is actually deeper than this, and the examples I gave are just coincidental.

share|improve this question

marked as duplicate by slhck, Nifle, random Aug 25 '11 at 12:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
windows'\' rest of world '/' –  mic84 Aug 25 '11 at 6:53
1  
You really should read the answers that are already here, mic84. They already showed that that isn't true. –  JdeBP Aug 25 '11 at 6:58
    
i dropped it in and tried to remove sorry, i've been sitting here with this page open thinking it was canceled sorry –  mic84 Aug 25 '11 at 8:10
add comment

4 Answers

Unix and its variants have always used the forward slash (/) to denote filesystem hierarchy.

However, Windows owes its filesystem delimiter, the backslash (\), to its MS-DOS predecessor. And MS-DOS wasnt the originator of that. It was brought over from the QDOS operating system (which borrowed from CP/M), which MS bought and reworked into MS-DOS.

Since most, if not all, of web based protocols originated on UNIX (HTTP, FTP, etc.), Microsoft complies with those delimiters to keep compatibility.

share|improve this answer
1  
MS did not buy CP/M. MS bought QDOS (Quick and Dirty DOS), which was a simple clone of CP/M, and reworked that into MS-DOS. –  Keith Aug 25 '11 at 6:45
    
@keith - u r correct. Fixed my answer. –  Keltari Aug 25 '11 at 6:47
add comment

That's not an accurate explanation. The path separator is just a character, a token, that is somewhat arbitrary but usually chosen to mark a natural separation. The backslash as path separator comes from the lineage of CP/M, DOS, and Windows. The slash comes from Unix and possibly other systems before it.

The Internet URL path separator was chosen to be the slash since most of the developers of the standards where familiar with Unix. The Unix slash as path separator is usually considered to be the canonical separator. Its position on the keyboard also makes it easier to type for most people that have to enter it a lot.

Even cross platform scripting languages, such as Python, use the slash is the "normalized form" of specifying paths.

share|improve this answer
1  
Also notice DCL in VMS. Qualifiers are preceded by forward slashes, just as in Microsoft's command. –  JdeBP Aug 25 '11 at 7:11
add comment

At an implementation level, windows will handle '/' the same way as '\'. I would just use the '/'. It will make all you applications portable. MySQL and python also translates the '/' to what ever you need on your system, depending one what path separator they use.

The '\' is used in other areas like regular expressions, and some terminals and programming languages as an escape char. That will ensure the next char following it will be interpreted as a literal character, such as \n \r at the end of lines.

As far as notation regarding internal or external systems that is not actually true. The '/' was more popular early on with the *nix systems. Microsoft then become popular and now '\' is what people expect. But as I mentioned Microsoft has to be posix (posix a standard on how operating systems should operate) compliant which means that you could replace all the '\' with '/' in most places and every thing would work with out problems.

share|improve this answer
add comment

Mostly it is just convention.

Windows seems to favor '\' while Linux and Unix seem to favor '/'

You can read in detail about paths and the various notations used on different systems on Wikipedia.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.