為什麼 Windows 的路徑分隔符和 Linux、UNIX 的方向相反?

基於什麼原因,是IBM時代的還是這個公司自己的決定,其他公司比如王安公司有類似的指令嗎


根據wikipedia Backslash

MS-DOS 2.0, released 1983, copied the hierarchical file system from Unix and thus used the (forward) slash,
but (possibly on the insistence of IBM) added the backslash to allow
paths to be typed at the command line interpreter"s prompt while
retaining compatibility with MS-DOS 1.0 and CP/M where the slash was the command-line option indicator (typing "DIR/W" gave the "wide" option to the "DIR" command, so some other method was needed if you actually wanted to run a program called W inside a directory called DIR). Except for COMMAND.COM, all other parts of the operating system accept both characters in a path, but the Microsoft convention remains to use a backslash, and APIs that return paths use backslashes. This holds true for MS-DOS and PC DOS, but also all other DOS operating systems like DR-DOS, PTS-DOS, RxDOS or FreeDOS as well as to Concurrent DOS, Multiuser DOS, FlexOS, 4680 OS, 4690 OS, OS/2 and Windows. In some versions of DOS, the option character can be changed from / to - via SWITCHAR, which allows COMMAND.COM to preserve / in the command name.

IBM的工具用的/作為參數起始,DOS很可能為了跟其區分就用作為路徑。


Windows 繼承 DOS

DOS 用反斜線是因為當時的命令行工具用正斜線作為選項的標誌字

而這個是繼承 CP/M 的,當時文件系統還沒目錄功能……


繼承自 CP/M 的。


/不存在轉移,和\在win下一樣


推薦閱讀:

有什麼關於昆明的冷知識?
赤手空拳的人能打贏成年野生獅子或老虎嗎?
有哪些冷門卻好聽的英文歌?
植物開花的時候有聲音嗎?
為什麼現在的生活中遇到複姓這樣少?

TAG:微軟Microsoft | Linux | IBM | Unix | 冷知識 |