chrishoffman — 2014-02-10T04:04:20-05:00 — #1
Originally published at: http://www.howtogeek.com/181774/why-windows-uses-backslashes-and-everything-else-uses-forward-slashes/
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.
nsdcars5 — 2014-02-10T04:36:31-05:00 — #2
Note: Android doesn't have /home; it has /data, /sdcard, and sometimes /ext_card or /external_sd.
meoow — 2014-02-10T09:31:40-05:00 — #3
Windows' backslash matters when you do programming. Say a string "d:\new\day" which you think it is a path but most programming languages see it as a totally different thing, especially when regular expression involved. You have to use double backslash to get one literal backslash.
The design of windows is so freaking stupid.
wilsontp — 2014-02-10T11:37:22-05:00 — #4
It's not stupid at all. The decision makes perfect sense, considering the choice of using the slash as the "switch" flag in command-line programs.
And it's not like the slash was a universal directory separator, either. When MacOS was introduced, it used the colon character.
DOS and Windows have gone through a lot of changes over the years, but I wouldn't call its design any more stupid or chaotic than its only competitor these days, Unix and its children. How many command shells does Unix have these days? csh, bash, ksh.... and then there are all the different flavors: AIX, BSD, Linux (with its own gazillion breeds), and MacOS.
And MacOS discarded X-Window completely in favor of a new graphical environment. So proper Unix programs, even after being compiled from source, still need to be ported to work properly on the Mac without needing a separate X server to fire up.
yeah, Windows is the one with the problem.
damian — 2014-02-10T12:17:11-05:00 — #5
Forward slash? Geek twitch!
wilsontp — 2014-02-10T17:38:59-05:00 — #6
Right... the term is "slash". There's no such thing as a "forward slash."
marvin_robertss — 2014-02-10T17:50:14-05:00 — #7
We could go with the OpenVMS file structure and use periods as the directory level delimiter.
See, with periods you don't have to worry about using the regular character (slash) or the back one (backslash).
tsoderlu — 2014-02-13T06:24:41-05:00 — #8
Actually, Firefox FAILS horribly at translating http:\\howtogeek.com\ (for some reason this you have to write three backslashes to make it show two here in this commenting section) to http://www.howtogeek.com/ and instead transforms it to http://www.//howtogeek.com/. Dunno if it works with Crome but with IE 11 it works, imagine that.
nsdcars5 — 2014-02-13T10:05:13-05:00 — #9
Chrome has an "h" in it. Sorry, couldn't resist.
Chrome is okay - http:\windows.com turns to http://windows.com (which then turns to http://windows.microsoft.com, but that's not important).
system — 2014-02-20T04:04:27-05:00 — #10
This topic was automatically closed after 10 days. New replies are no longer allowed.