This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2002-03-10.01:47:01
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435

Sorry, I'm closing as "Won't Fix".  os.system() and os.popen
() are barely usable on Windows, and it's going to remain 
that way until Python grows its own command shell.  Before 
that, it's at the mercy of what the MS shells happen to 
do.  In the case of XP's cmd.exe, you're a victim of 
documented (by MS) behavior:  see the /C and /K options to 
cmd.exe:

"""
If /C or /K is specified, then the remainder of the command 
line after the switch is processed as a command line, where 
the following logic is used to process quote (") 
characters: 

    1. If all of the following conditions are met, then 
quote characters on the command line are preserved: 

        - no /S switch 
        - exactly two quote characters 
        - no special characters between the two quote 
characters, where special is one of: &<>()@^| 
        - there are one or more whitespace characters 
between the two quote characters 
        - the string between the two quote characters is 
the name of an executable file. 

    2. Otherwise, old behavior is to see if the first 
character is a quote character and if so, strip the leading 
character and remove the last quote character on the 
command line, preserving any text after the last quote 
character.
"""

You're a victim of clause #2 there.  The MS shells aren't 
consistent about these rules, so there's nothing Python can 
do to try to out-guess them, short of heroic efforts.  For 
example, if we took your suggestion, things that work fine 
today under Win98's command.com would suddenly break (W98 
does *not* strip the new quotes you're adding, so "Bad 
command or file name" is the usual result).
History
Date User Action Args
2007-08-23 13:59:04adminlinkissue512433 messages
2007-08-23 13:59:04admincreate