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

Andrew Dalke adalke at mindspring.com
Thu Sep 25 22:03:10 EDT 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
                    dalke at dalkescientific.com






More information about the Python-list mailing list