Weeble <clockworksa...@gmail.com> added the comment:

I'm not sure what rules are used by Windows to process the PATH string, but I 
think they are similar to the rules used to parse the command-line into argv in 
a C/C++ program: http://msdn.microsoft.com/en-us/library/17w5ykft.aspx

I have tested various arrangements of double-quotes in path elements. It 
appears the quotes can appear anywhere, not just at the start and end of 
entries. As far as I can tell, *all* they do is toggle the interpretation of 
the semicolon character between a separator and a character in the directory 
path. Note in particular: quotes may surround an entire path, segments of a 
path, fragments of segments of a path, or even may be completely empty. Any 
number of quotes can appear in a single path entry. There doesn't even need to 
be an even number of quotes - it seems that an odd number of quotes are treated 
the same as if a final quote was appended to the very end of the PATH string.

Running my attached test batch file, I see these results:

c:\Users\weeble>pathtest
PATH=
FAIL

PATH=c:\Users\weeble\foo;bar
FAIL

PATH=c:\Users\weeble\"foo;bar"
SUCCESS

PATH="c:\Users\weeble\foo;bar"
SUCCESS

PATH=c:\Users\weeble\"foo;"bar
SUCCESS

PATH=c:\Users\weeble\foo";"bar
SUCCESS

PATH=c:\Users\weeble\""foo";"bar""
SUCCESS

PATH=
FAIL

PATH=c:\Users\weeble\foo";bar
SUCCESS

----------
nosy: +weeble
Added file: http://bugs.python.org/file23797/pathtest.bat

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue444582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to