R. David Murray added the comment: This is a only a duplicate of issue 1300 in the sense that that issue points out that list2cmdline has nothing to do with passing/quoting strings for cmd.exe.
list2cmdline is an internal function of the subprocess module. Its docstring documents the MS C quoting rules, *not* the input quoting rules. So its output is correct according to its doc string. If you pass ["test.bat", r'\"1|2\"'] to Popen using Richard's version of test.bat, you should get \"1|2\" as the output, which would be correct, since that is what you passed in as the argument to test.bat in the Popen call. The point is that the arguments specified in the list (shell=False) Popen call is supposed to be exactly what arguments get passed to the called program, and list2cmdline takes care of the MS C quoting to make that happen. (I don't use Windows much, so it is a bit of a pain for me to confirm the above example, but I'm nearly certain it will work as I say, modulo whatever quoting rule 'echo' uses for output.) ---------- components: +Benchmarks -Library (Lib) resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18649> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com