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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephen Ferg

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

    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?
  • Ben Finney

    #2
    Re: When did Windows start accepting forward slash as a path separator?

    On 25 Sep 2003 16:50:49 -0700, Stephen Ferg wrote:[color=blue]
    > 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.[/color]

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

    Comment

    • Bob Gailer

      #3
      Re: When did Windows start accepting forward slash as a pathseparator?

      At 05:50 PM 9/25/2003, Stephen Ferg wrote:
      [color=blue]
      >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?[/color]

      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
      bgailer@alum.rp i.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

      Comment

      • Andrew Dalke

        #4
        Re: When did Windows start accepting forward slash as a path separator?

        Stephen Ferg:[color=blue]
        > When did Windows start accepting the forward slash as a path separator
        > character?[/color]

        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.
        [color=blue]
        > 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.[/color]

        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. ;)
        [color=blue]
        > 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?[/color]

        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@dalkescie ntific.com


        Comment

        • Michael Geary

          #5
          Re: When did Windows start accepting forward slash as a path separator?

          Stephen Ferg wrote:[color=blue]
          > 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?[/color]

          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


          Comment

          • Michael Geary

            #6
            Re: When did Windows start accepting forward slash as a path separator?

            > Stephen Ferg wrote:[color=blue][color=green]
            > > 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.[/color][/color]

            Ben Finney wrote:[color=blue]
            > 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.[/color]

            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


            Comment

            • Andrew Dalke

              #7
              Re: When did Windows start accepting forward slash as a path separator?

              Bob Gailer:[color=blue]
              > 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.[/color]

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

              cd ./samis

              Andrew
              dalke@dalkescie ntific.com


              Comment

              • Grant Edwards

                #8
                Re: When did Windows start accepting forward slash as a path separator?

                In article <b16e4ef7.03092 51550.724a57f@p osting.google.c om>, Stephen Ferg wrote:
                [color=blue]
                > When did Windows start accepting the forward slash as a path separator
                > character?[/color]

                Sometime prior to 1983. DOS has always accepted it, and I assume Windows
                always has as well.
                [color=blue]
                > 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,[/color]

                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.
                [color=blue]
                > whereas Unix used the forward slash.[/color]
                [color=blue]
                > 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.[/color]

                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.
                [color=blue]
                > I hypothesize that originally Windows accepted only the backslash, and then
                > at some time it changed to accept the forward slash as well.[/color]

                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.
                [color=blue]
                > Does anyone know when that change occurred? Was it with the introduction of
                > support for long filenames in NT and Win95?[/color]

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

                Comment

                • Grant Edwards

                  #9
                  Re: When did Windows start accepting forward slash as a path separator?

                  In article <slrnbn74ch.s2. bignose-hates-spam@rose.local domain.fake>, Ben Finney wrote:
                  [color=blue][color=green]
                  >> 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.[/color]
                  >
                  > I highly doubt it, since the forward slash (or just "slash") is the
                  > conventional Windows command-line option indicator,[/color]

                  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.
                  [color=blue]
                  > 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.[/color]

                  Forward slashes always worked fine for me.
                  [color=blue]
                  > 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?[/color]

                  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!

                  Comment

                  • Michael Geary

                    #10
                    Re: When did Windows start accepting forward slash as a path separator?

                    Grant Edwards wrote:[color=blue]
                    > 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.[/color]

                    It was the DOS system calls.

                    -Mike


                    Comment

                    • Jules Dubois

                      #11
                      Re: When did Windows start accepting forward slash as a path separator?

                      On 25 Sep 2003 16:50:49 -0700, in article
                      <b16e4ef7.03092 51550.724a57f@p osting.google.c om>, Stephen Ferg wrote:
                      [color=blue]
                      > When did Windows start accepting the forward slash as a path separator
                      > character?[/color]

                      Even MS-DOS 3.3 would accept '/'; the command-line utilities were
                      programmed to use only '\' without some start-up parameter (PATHSEP?).
                      Microsoft removed that feature in v4.0 or 5.0. The "kernel" didn't care.

                      The Windows kernels are the same. The internals of the operating system
                      accept either.

                      Comment

                      • Tim Roberts

                        #12
                        Re: When did Windows start accepting forward slash as a path separator?

                        Grant Edwards <grante@visi.co m> wrote:[color=blue]
                        >
                        >Ben Finney wrote:
                        >[color=green][color=darkred]
                        >>> 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.[/color]
                        >>
                        >> I highly doubt it, since the forward slash (or just "slash") is the
                        >> conventional Windows command-line option indicator,[/color]
                        >
                        >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.[/color]

                        Yes, indeed. There was a SWITCHAR option in config.sys, and a
                        corresponding DOS service, until DOS 3.0, when it was removed because they
                        couldn't make it work with network software.

                        So, the situation can be summed up rather simply:

                        * All DOS services since DOS 2.0 and all Windows APIs accept either
                        forward slash or backslash. Always have.

                        * None of the standard command shells (CMD or COMMAND) will accept
                        forward slashes. Even the "cd ./tmp" example given in a previous post
                        fails.
                        --
                        - Tim Roberts, timr@probo.com
                        Providenza & Boekelheide, Inc.

                        Comment

                        • Andrew Dalke

                          #13
                          Re: When did Windows start accepting forward slash as a path separator?

                          Tim Roberts:[color=blue]
                          > * None of the standard command shells (CMD or COMMAND) will accept
                          > forward slashes. Even the "cd ./tmp" example given in a previous post
                          > fails.[/color]

                          Yup. I should have copy&pasted rather than just type it in.
                          It should have been in quotes. The following does work for me

                          E:\dalke>cd ..

                          E:\>cd /dalke
                          The system cannot find the path specified.

                          E:\>cd ./dalke

                          E:\>cd "./dalke"

                          E:\dalke>ver

                          Windows NT Version 4.0

                          E:\dalke>

                          Andrew
                          dalke@dalkescie ntific.com


                          Comment

                          • Alex Martelli

                            #14
                            Re: When did Windows start accepting forward slash as a path separator?

                            Grant Edwards wrote:
                            ...[color=blue]
                            > 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.
                            >[color=green]
                            >> Does anyone know when that change occurred? Was it with the introduction
                            >> of support for long filenames in NT and Win95?[/color]
                            >
                            > I'm not aware that there has ever been a "change". '/' has been OK since
                            > the early DOS days.[/color]

                            I _think_ (can't be sure...) that at a C-libraries level the switch
                            occurred either between DOS 1.0 and 1.1, or at the time of release of
                            2.0. It's hard to say, because MS didn't release a C compiler as a
                            product back then; however, it seems that, internally, they used C
                            compilers running on their Unix machines (presumably their own version
                            of Unix, named Xenix, which they later sold to SCO) to generate some
                            parts of the DOS stuff of that age. The original QDOS ("Quick and
                            Dirty OS") that they bought out and resold as DOS 1.0 surely had no
                            knowledge of forward slashes -- it was basically CP/M disassembled,
                            hacked and reassembled (all quite illegally of course). Just as surely,
                            DOS 2.0 had that knowledge (Allen had also hacked into it some Unix
                            idioms such as I/O redirection and pipes -- some "pipes", redirecting
                            to a temporary file and then back out of it!, but syntactically Unixoid --
                            and more generally made it an uneasy mixmash of some concepts and
                            practice from the CP/M world plus a little from Unix traditions); and
                            so did the first C compiler, self-hosted on DOS, that MS later sold to
                            the public (having bought it, I believe, from Lattice).


                            Alex

                            Comment

                            • Grant Edwards

                              #15
                              Re: When did Windows start accepting forward slash as a path separator?

                              In article <GpScb.123559$h E5.4229137@news 1.tin.it>, Alex Martelli wrote:
                              [color=blue][color=green][color=darkred]
                              >>> Does anyone know when that change occurred? Was it with the introduction
                              >>> of support for long filenames in NT and Win95?[/color]
                              >>
                              >> I'm not aware that there has ever been a "change". '/' has been OK since
                              >> the early DOS days.[/color]
                              >
                              > I _think_ (can't be sure...) that at a C-libraries level the switch
                              > occurred either between DOS 1.0 and 1.1, or at the time of release of
                              > 2.0.[/color]

                              I don't think 1.0 had a hierarchical filesystem at all did it?

                              IIRC, it was basically the same as CP/M 2.2 and had nothing other than a
                              "root" directory on each floppy [IIRC, CP/M 3.x had some concept of multiple
                              directories on a floppy but it wasn't a tree structured FS with "paths" --
                              it was more like partitioning a floppy into multiple drive letters.]

                              By the time I got my hands on IBM machines 2.x was in common use, so I only
                              had a brief exposure to 1.x.

                              --
                              Grant Edwards grante Yow! .. I want to perform
                              at cranial activities with
                              visi.com Tuesday Weld!!

                              Comment

                              Working...