Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > When did Windows start accepting forward slash as a path separator?

Reply
Thread Tools

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

 
 
Stephen Ferg
Guest
Posts: n/a
 
      09-25-2003
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?
 
Reply With Quote
 
 
 
 
Ben Finney
Guest
Posts: n/a
 
      09-26-2003
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/>
 
Reply With Quote
 
 
 
 
Bob Gailer
Guest
Posts: n/a
 
      09-26-2003
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
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

 
Reply With Quote
 
Michael Geary
Guest
Posts: n/a
 
      09-26-2003
Stephen Ferg wrote:
> 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?


Hi Steve,

Every version of Windows has accepted "/" as a path separator. So has every
version of MS-DOS beginning with DOS 2.0 (the first version that had
subdirectories).

It's only been in command lines that "/" was not allowed, because it had
already been used as a switch delimiter in MS-DOS 1.0.

-Mike


 
Reply With Quote
 
Andrew Dalke
Guest
Posts: n/a
 
      09-26-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
(E-Mail Removed)


 
Reply With Quote
 
Michael Geary
Guest
Posts: n/a
 
      09-26-2003
> 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.


Ben Finney wrote:
> 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.


Actually, every version of Windows, and every version of MS-DOS from 2.0 on,
has accepted "/" as a path delimiter.

Don't confuse the command line with the Windows or DOS kernel. Most command
lines don't allow "/" because it conflicts with the use of "/" for a switch
deliminer. But the Windows and DOS kernels are happy with either "\" or "/".

-Mike


 
Reply With Quote
 
Andrew Dalke
Guest
Posts: n/a
 
      09-26-2003
Bob Gailer:
> 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.


The shell is parsing the line and interprets the "/" as a
command-line flag, Try a relative path, like

cd ./samis

Andrew
(E-Mail Removed)


 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      09-26-2003
In article <(E-Mail Removed)> , Stephen Ferg wrote:

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


Sometime prior to 1983. DOS has always accepted it, and I assume Windows
always has as well.

> 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,


Accepted as a truism by whom? DOS would accept either. The shell's "switch"
character was configurable as well -- it defaulted to '/' but changing it to
'-' was trivial.

> 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 don't remember if the actual DOS system calls accepted '/' or if the C
library translated. I do know that DOS C programs could use '/' for path
separator at least 20 years ago.

> I hypothesize that originally Windows accepted only the backslash, and then
> at some time it changed to accept the forward slash as well.


Nope. AFAIK, it's always accepted '/'. I did C programming on DOS for
years, and I always used '/' since it was too error working with string
literals in C that contain '\'. Those same programs seemed to run fine
under Windows.

> Does anyone know when that change occurred? Was it with the introduction of
> support for long filenames in NT and Win95?


I'm not aware that there has ever been a "change". '/' has been OK since
the early DOS days.

--
Grant Edwards grante Yow! WHOA!! Ken and
at Barbie are having TOO
visi.com MUCH FUN!! It must be the
NEGATIVE IONS!!
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      09-26-2003
In article <(E-Mail Removed)>, Ben Finney 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,


That was configurable back in the DOS days. There was a "well-known" byte in
system RAM that contained the "switch" character. IIRC, DOS even shipped
with a utility to change that value.

> 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.


Forward slashes always worked fine for me.

> 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?


Forward slashes work in C as well.

--
Grant Edwards grante Yow! Yow! It's some people
at inside the wall! This is
visi.com better than mopping!
 
Reply With Quote
 
Michael Geary
Guest
Posts: n/a
 
      09-26-2003
Grant Edwards wrote:
> I don't remember if the actual DOS system calls accepted '/' or if
> the C library translated. I do know that DOS C programs could
> use '/' for path separator at least 20 years ago.


It was the DOS system calls.

-Mike


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash! Ed Java 6 08-02-2007 03:29 PM
Links to https fails 404 with preceding forward slash Greg Collins [Microsoft MVP] ASP .Net 2 06-15-2006 07:17 PM
What's the forward slash for at the end of a URL? xyZed HTML 3 03-04-2006 09:00 AM
IE6 inserts forward slash at end of URL so image htm Richard Wright Computer Support 0 03-20-2005 08:13 PM
RE: When did Windows start accepting forward slash as a path separator? Tony Meyer Python 1 09-26-2003 02:22 PM



Advertisments