unexpected os.system behavior on windows NT
Thomas Heller
theller at python.net
Wed May 8 15:34:41 EDT 2002
> os.system seems to malfunction when the command name and another
> argument are both quoted on the commandline. All these commands
> run "as expected" when executed directly in a command window.
I've posted this before... There are strange rules of cmd.exe regarding
quotes, but 'cmd /?' on Win2k finally documents them.
Thomas
-----
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
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.
More information about the Python-list
mailing list