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

Stephen Horne $$$$$$$$$$$$$$$$$ at $$$$$$$$$$$$$$$$$$$$.co.uk
Fri Sep 26 16:22:53 CEST 2003


On Fri, 26 Sep 2003 16:34:44 +1200, "Tony Meyer" <ta-meyer at ihug.co.nz>
wrote:

>>   * None of the standard command shells (CMD or COMMAND) will 
>> accept forward slashes.  Even the "cd ./tmp" example given in 
>> a previous post fails.
>
>Not true:
>
>"""
>Microsoft Windows XP [Version 5.1.2600]
>(C) Copyright 1985-2001 Microsoft Corp.
>
>C:\>cd /spambayes
>
>C:\spambayes>cd ./spambayes
>
>C:\spambayes\spambayes>
>"""
>
>This is with cmd.exe in XP (as above).  command.exe does try and use it as a
>switch.  I have no idea about older versions, nor do I care <wink>.
>
>=Tony Meyer
>

Yes, but...


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

E:\>f:

F:\>cd /dev
The system cannot find the path specified.

F:\>cd \dev

F:\Dev>


What Windows XP is doing is very recent - even Windows 2000 does not
accept forward slashes in that context.

Fortunately, while 'cd' seems to interpret '/' as part of a filename,
'md' knows better and won't let you create a folder with a '/' in the
name.

The first place I started noticing forward slashes working was in
explorer - it had to support them for web pages I guess, and command
line options weren't an issue, so supporting them for filenames wasn't
difficult - and probably helped in contexts such as FTP which uses
unix-based filename conventions (you don't see it in explorer of
course but there is still presumably a hidden FTP 'command line'
session in the background). It was probably just a matter if sharing
the name parsing code as much as possible between contexts. But this
is pure guesswork - I wouldn't be surprised if this is wrong.

I have also noticed that at least some of Windows APIs accept forward
slashes as path separators. I can't remember what exactly, though - it
could just be something like the file selector dialog.


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list