Bill Janssen wrote:
> I'm actually not passing file names.  I'm passing argument strings,
> which may contain spaces, quotes, and other things.  For instance,
>
>    myprogram --title="That's the game! says Mike "Hammer" Brotsky" --file=...
>
> "myprogram" is a Python program, and expects to get the whole "--title"
> argument as a single element of sys.argv.
>
> On Unix, I use
>
>    arg = "--title=%s" % pipes.quote(title)
>
> to achieve that effect.  What's the equivalent on Windows?  Since
> cmd.exe also supports pipelines, I'd sort of expect it to do the right
> thing on Windows, too.
>   

Ah, foolish mortal.

The problem with Windows is that, as I said, there is no central
command-line parser, so there is no single set of rules.  Cmd.exe does
not parse the command line.  Cmd.exe does not create argc/argv.  Cmd.exe
just passes the whole command line as a string.  For C programs, the C
run-time library will crack that string into argc/argv.  Python on
Windows has its own parser.

If you are creating a list of arguments to pass AS A LIST, then no
quoting is necessary.  If you intend to mash them together into a single
string, then I'm afraid you will need to experiment.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to