Windows什么时候开始接受正斜杠作为路径分隔符? [英] When did Windows start accepting forward slash as a path separator?

查看:188
本文介绍了Windows什么时候开始接受正斜杠作为路径分隔符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与Python无关的问题。但是我认为

我会问我认识的最博学的团队...... :-)


Windows什么时候开始接受正斜杠一个路径分隔符

字符?


曾经有人认为它是Windows(如MS-DOS)的一个老生常谈。

与Unix不同,因为Windows使用反斜杠作为路径

分隔符,而Unix则使用正斜杠。


但是现在,在一个小组中对于认知,这是一个不言而喻,这是一个神话,Windows允许你使用前向

或反斜杠作为路径名分隔符。


我假设原来Windows只接受反斜杠,然后

然后在某些时候它也改为接受正斜杠。

有谁知道发生了什么变化?是否在NT和Win95中引入了对长文件名的支持?

解决方案

2003年9月25日16: 50:49 -0700,斯蒂芬·弗格写道:

但是现在,在一小群认知中,这是一个神话,这是一个神话,Windows允许你使用无论是前向
还是反向斜杠作为路径名分隔符。




我非常怀疑它,因为正斜杠(或只是斜杠)是

传统的Windows命令行选项指示器,类似于Unix上的

连字符。接受它作为文件名的开头会破坏现有系统的数百亿美元,这对微软来说没有明显的好处。


Python自动确定路径组件分隔符,os.sep,

并将其用于大多数文件路径转换,来自内部

语言''''''。


< http://www.python.org/doc/2.3.1/lib/os-path.html#l2h-1552>


这是也许是什么让你印象深刻?


-

\我去了一家随时供应早餐的餐厅。所以|

` \在文艺复兴时期我点了法国吐司。 - 史蒂文|

_o__)赖特|

Ben Finney< http://bignose.squidly.org/>


在2003年9月25日下午5点50分,Stephen Ferg写道:

我有一个与Python无关的问题。但是我想 -
我会问我认识的最博学的团队...... :-)

Windows什么时候开始接受正斜杠作为路径分隔符
字符?




好​​问题。当然晚于:


Microsoft Windows 2000 [版本5.00.2195]

(C)版权所有1985-2000 Microsoft Corp.

C:\> cd / samis

命令的语法不正确。


Bob Gailer
bg ***** @ alum.rpi.edu

303 442 2625

---

外发邮件经过无病毒认证。

由AVG反病毒系统检查( http://www.grisoft.com)

版本:6.0.506 /病毒库:303 - 发布日期:2003年8月1日


Stephen Ferg:

Windows什么时候开始接受正斜杠作为路径分隔符<性格?


DOS 2.引入目录时。许多功能

基于unix,低至NUL终止文件名和

名称creat。


但是DOS 1是在CP / M上建模的,它使用了/。作为命令

行选项标志。你不能使用/在DOS shell中因为

它将被解释为标志。您可以使用

DOS命令更改标志,例如,使用 - 相反,但是在3.x天的时间里被禁用了
;有充分的理由。


因此,低级DOS命令(自2.0开始)将

/和\作为分隔符,但有些代码确实如此他们自己

文件名munging而不会。

曾经有人认为,Windows(如MS-DOS)与Unix不同是不同的因为Windows使用反斜杠作为路径
分隔符,而Unix使用正斜杠。


这是?我的诺顿IBM PC指南的副本使

明确声明目录直接受到

unix的影响。我实际上认为这是一个相似之处。使用的字符

是一个小问题。


当然,它们有很多种不同的方式。比如

来自CP / M的驱动器名称,以及文件系统布局

本身(FAT与inode)。 DOS有更好的IDE,比如

Turbo Pascal。 ;)

我假设原来Windows只接受反斜杠,然后在某个时候它也改为接受正斜杠。
有谁知道发生了什么变化?是否在NT和Win95中引入了对长文件名的支持?




原始Windows是DOS上的shell。程序
Windows下的
可以直接使用DOS层,这两个分隔符都是

。即使在Wn95中我也可以退出到DOS,意思是

我可以完全退出Win95到shell提示符然后再赢'

再次启动它。 br />

Andrew
da***@dalkescientific.com


I have a question that is not directly Python-related. But I thought
I''d ask the most erudite group that I know... :-)

When did Windows start accepting the forward slash as a path separator
character?

At one time, it was accepted as a truism that Windows (like MS-DOS)
was different from Unix because Windows used the backslash as the path
separator character, whereas Unix used the forward slash.

But now, among a small group of cognoscenti, it is a truism that this
is a myth, and that Windows will allow you to use either the forward
or the backward slash as a pathname separator.

I hypothesize that originally Windows accepted only the backslash, and
then at some time it changed to accept the forward slash as well.
Does anyone know when that change occurred? Was it with the
introduction of support for long filenames in NT and Win95?

解决方案

On 25 Sep 2003 16:50:49 -0700, Stephen Ferg wrote:

But now, among a small group of cognoscenti, it is a truism that this
is a myth, and that Windows will allow you to use either the forward
or the backward slash as a pathname separator.



I highly doubt it, since the forward slash (or just "slash") is the
conventional Windows command-line option indicator, analogous to the
hyphen on Unix. To accept it as the start of a filename would break
zillions of existing systems, for no appreciable benefit to Microsoft.

Python automagically determines the path component separator, os.sep,
and uses it for most file path transformations to and from the internal
language''s ''/''.

<http://www.python.org/doc/2.3.1/lib/os-path.html#l2h-1552>

Is this perhaps what gives you the impression?

--
\ "I went to a restaurant that serves ''breakfast at any time''. So |
`\ I ordered French Toast during the Renaissance." -- Steven |
_o__) Wright |
Ben Finney <http://bignose.squidly.org/>


At 05:50 PM 9/25/2003, Stephen Ferg wrote:

I have a question that is not directly Python-related. But I thought
I''d ask the most erudite group that I know... :-)

When did Windows start accepting the forward slash as a path separator
character?



Good question. Certainly later than:

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>cd /samis
The syntax of the command is incorrect.

Bob Gailer
bg*****@alum.rpi.edu
303 442 2625
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


Stephen Ferg:

When did Windows start accepting the forward slash as a path separator
character?
DOS 2. When directories were introduced. Many of the functions
were based on unix, down to a NUL terminated filename and the
name "creat".

But DOS 1 was modelled on CP/M which used "/" as a command
line option flag. You couldn''t use a "/" in the DOS shell because
it would be interpreted as the flag. You could change the flag using
a DOS command, eg, to use "-" instead, but that was disabled in
the 3.x days; for good reason.

Hence, the low-level DOS commands (since 2.0) would take
both / and \ as separators, but some codes did their own
filename munging and would not.
At one time, it was accepted as a truism that Windows (like MS-DOS)
was different from Unix because Windows used the backslash as the path
separator character, whereas Unix used the forward slash.
It was? My copy of Norton''s Guide to the IBM PC makes
the explicit statement that directories were directly influenced by
unix. I actually regard this as a point of similarity. The character
used is a minor issue.

There are, of course, many ways in which they are different. Like
drive names, which comes from CP/M, and the filesystem layout
itself (FAT vs. inodes). And DOS had much better IDEs, like
Turbo Pascal. ;)
I hypothesize that originally Windows accepted only the backslash, and
then at some time it changed to accept the forward slash as well.
Does anyone know when that change occurred? Was it with the
introduction of support for long filenames in NT and Win95?



The original Windows was a shell on top of DOS. Programs
under Windows could use the DOS layer directly, which took
both separators. Even in Wn95 I could exit to DOS, meaning
I could quite out of Win95 to the shell prompt then do ''win''
to start it up again.

Andrew
da***@dalkescientific.com


这篇关于Windows什么时候开始接受正斜杠作为路径分隔符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆