Live data from Hacker News

Why is the DOS path character "\"?

blogs.msdn.com

31–40 of 68 posts

Re: Why is the DOS path character "\"?

#31
post #8

Earlier quoted context omitted.

A simple way to remember forward/backslash (which I probably read on HN) is the phrase "Backslash is by the backspace" Edit: This is for the standard US keyboard. A more general way of thinking about it, though a bit more to remember: associate "positive" with "forward", and see that '/' has a positive slope. Or just go listen to a BBC podcast, and let the sound of the broadcaster saying "bbc dot co dot uk forward-sl…

Backslash is near L-Ctrl on my keyboard. Forward slash is far closer to backspace. Perhaps a better way would be to think (for L-to-R language users) of the charater toppling "forwards" / or "backwards" \ WRT the text direction.

Echoing parent, in different words:

English is left-to-right. (And gravity is down.)

Is the slash "leaning forward" or is it "leaning backward".

Re: Why is the DOS path character "\"?

#32

I've always felt the better question is "Why is the UNIX path character "/"? People use "/" as a date separator as in 12/25/1979 so effectively banning that character as a character in filenames seems a really poor choices. By that metric chosing "\" is a much better choice because "\" is used no where I know outside of computers. I've never encountered it anywhere outside of computers so arguable it's the perfect ch…

> I've always felt the better question is "Why is the UNIX path character "/"?

Just a guess, but it's probably because \ is used for character escapes in C (and the Bourne shell). Given that the history of Unix is inextricably tied to C, it kind of makes sense to use / over \ so you don't have to do lots of \\ to escape path names.

Re: Why is the DOS path character "\"?

#33

I've always felt the better question is "Why is the UNIX path character "/"? People use "/" as a date separator as in 12/25/1979 so effectively banning that character as a character in filenames seems a really poor choices. By that metric chosing "\" is a much better choice because "\" is used no where I know outside of computers. I've never encountered it anywhere outside of computers so arguable it's the perfect ch…

This is a good thing though since this encourages more people to use the ISO date formats. They are unambiguous, easy to parse and sort correctly

Re: Why is the DOS path character "\"?

#34
post #33

I've always felt the better question is "Why is the UNIX path character "/"? People use "/" as a date separator as in 12/25/1979 so effectively banning that character as a character in filenames seems a really poor choices. By that metric chosing "\" is a much better choice because "\" is used no where I know outside of computers. I've never encountered it anywhere outside of computers so arguable it's the perfect ch…

This is a good thing though since this encourages more people to use the ISO date formats. They are unambiguous, easy to parse and sort correctly

There are other uses of the slash character. It's a poor choice.

_ or | get my vote, but it's a bit late now to fix the mistakes of the past. There are enough special chars needed anyway that collisions are inevitable.

At least they didn't pick 'E'.

Re: Why is the DOS path character "\"?

#35

What bugs me is that they chose a character right next to "Return" on the keyboard. For some reason no PC keyboard has moved it. I've had embarrassing MS-DOS moments in the past where I was typing out something like a recursive-delete on a path. If you accidentally hit RETURN instead of a backslash then you can do things like blow away entire parent directories unintentionally. This didn't exactly improve my already-…

That is interesting, I have had the exact opposite experience!

I have never seen a PC keyboard with the backslash anywhere other than in the bottom LEFT corner next to your left smallest/pinky finger with one exception: in Germany and France, they keyboards sometimes have backslash on the top line numerical keys.

Re: Why is the DOS path character "\"?

#36
post #14

Interestingly, if you ever come to Japan you will find many people expect path separators to be yen symbols (¥). Their windows paths look like: ¥docs¥finance¥ To understand the reason, just check out the table on the Shift-JIS encoding: http://en.wikipedia.org/wiki/Shift_JIS Specifically, look at the character at 0x5C where the backslash sits in ASCII. Learning this was one of those mind-blowing moments when you try…

The Korean won symbol ₩ also occupies 0x5C. I never got totally used to seeing directory paths separated by ₩.

I have the korean QSENN DT-35 keyboard. The first time I opened up the cmd, I couldn't find the '\' and had to click random keys until I found the ₩ key :-D

Re: Why is the DOS path character "\"?

#37
post #28
post #7

Goes deeper than just IBM. Prior to DOS there was CP/M and CP/M had many programs with an older heritage. For example, it was possible to copy from a source (such as a file) to a destination (such as another file, or an I/O port) using a program called PIP ( http://en.wikipedia.org/wiki/Peripheral_Interchange_Program ). On CP/M, for example, you could print a file with the command (PRN: is the name of the printer dev…

You could still do that with copy in MS-DOS, I have a feeling my mom still does it since she has a printer on parallel port. So if she wants to print a textfile it's just copy file.txt LPT1 she can also print multiple files or results of print to file using the /b switch (binary) ignoring EOF That also explains why you shouldn't use LPT1 as file name - it was a special name that meant first parallel port. I remember…

"And that is why, in 2009, when developing in Microsoft .NET 3.5 for ASP.NET MVC 1.0 on a Windows 7 system, you cannot include /com\d(\..)?, /lpt\d(\..)?, /con(\..)?, /aux(\..)?, /prn(\..)?, or /nul(\..)? in any of your routes."

Source: http://news.ycombinator.com/item?id=655397

Re: Why is the DOS path character "\"?

#38
post #14

Interestingly, if you ever come to Japan you will find many people expect path separators to be yen symbols (¥). Their windows paths look like: ¥docs¥finance¥ To understand the reason, just check out the table on the Shift-JIS encoding: http://en.wikipedia.org/wiki/Shift_JIS Specifically, look at the character at 0x5C where the backslash sits in ASCII. Learning this was one of those mind-blowing moments when you try…

Obligatory link for this fact to the One True Source for oddities like these:

https://blogs.msdn.com/b/michkap/archive/2005/09/17/469941.a...

Re: Why is the DOS path character "\"?

#39

I've always felt the better question is "Why is the UNIX path character "/"? People use "/" as a date separator as in 12/25/1979 so effectively banning that character as a character in filenames seems a really poor choices. By that metric chosing "\" is a much better choice because "\" is used no where I know outside of computers. I've never encountered it anywhere outside of computers so arguable it's the perfect ch…

Other people use '.' in dates. Or '-'. Especially the latter would end up with the same problem: Why is - and -- used as a switch character if it is used in dates (and even quite common in normal text, names)?

And given that the history of '\' as a path separator is that long, maybe you haven't seen in elsewhere _because_ it is now forever taken for the world's most popular OS?

Re: Why is the DOS path character "\"?

#40
post #35

What bugs me is that they chose a character right next to "Return" on the keyboard. For some reason no PC keyboard has moved it. I've had embarrassing MS-DOS moments in the past where I was typing out something like a recursive-delete on a path. If you accidentally hit RETURN instead of a backslash then you can do things like blow away entire parent directories unintentionally. This didn't exactly improve my already-…

That is interesting, I have had the exact opposite experience! I have never seen a PC keyboard with the backslash anywhere other than in the bottom LEFT corner next to your left smallest/pinky finger with one exception: in Germany and France, they keyboards sometimes have backslash on the top line numerical keys.

Germany has a really awkward position for this key. You can only reach it by hitting 'Alt Gr' (the right Alt key) and a _right_ key in the row of digits. One-handed and similar (albeit mirrored) to the US layout's access to ~.

I .. switch all my keyboard to the US layout because I feel that I kill my fingers otherwise to reach {[]}| and \

Post reply on HN