Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why does MS-DOS use \ as the path separator, while Unix uses /?

MS-DOS path separator Unix uses
0
Posted

Why does MS-DOS use \ as the path separator, while Unix uses /?

0

Version 1 of MS-DOS didn’t have subdirectories or paths, and wasn’t much like Unix at all. The ‘/’ character was used to denote command options (like ‘-‘ in Unix); this was rather common in CP/M, and is the standard in many DEC operating systems. In version 2.0 of MS-DOS, many new Unix-like features were added, including subdirectories. Since ‘/’ was used for command options by many programs, that character couldn’t be used in paths. Apparently Microsoft thought ‘\’ was the second best alternative. It’s interesting to say that is the shell who requires ‘\’ as the path separator; the real DOS is quite happy with ‘/’, and when you program in C (for exemple), you can write a path as “c:\\foo\\bar\\…” or “c:/foo/bar/…”, and both work. Also, there was an undocumented feature of DOS which allowed the user to change the switch char, and freed ‘/’ to be used as a path separator in the command line. This no longer exists in DOS 5.0, and probably is absent in DOS 6.0, as well (I couldn’t tes

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123