Backslashes v Forward Slashes – Windows, Linux and Mac

“Why do I have to use backslashes (\) in Windows, but forward slashes (/) in everything else?” This is a question that I have been asked by a number of people over the years and I have been meaning to write something about it for a long time now. 

It seems that Windows is really the odd one out as Linux, OS X and even Android uses forward slashes. It seems that the cause of this annoying (at times) difference is due to accidental events. 

In the 1970s, Unix first introduced the forward slash to separate entries in a directory path. So far so good. In the meantime, the initial version of MS DOS did not even support the use of directories… and we are talking early 80s here! At the time, IBM has the main contributor to Microsofr utilities and they used the forward slash as a flag or switch character (In Unix we use a hyphen for this). You can still see a vestigial tail in some commands… Think dir /w for example. 

 The next version of MS DOs started support for directories and to keep compatibility, IBM expected to continue usage of / as a flag and as such the alternative for directory path separation, Windows started using \. Once you start using this in your own environment, who cares what other people use in their operating systems!! Right? In that way, in Windows the use of the different slashes tells you if you are running  an option (/) or a directory path (\). 

And the rest, as they say, is history!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.