winapi - escaping string on Windows command line -


i'm trying pass string win32 program command line printed without changes.

why have escape
"aaa <bbb@pobox.com>" """aaa <bbb@pobox.com>"""
but
"aaa <bbb@pobox.com>", (comma included) "\"aaa ^<bbb@pobox.com^>\","

i see no consistency in escaping rules windows command line

p.s. i'm trying generate .cmd file

update:

i'm using simple c program testing compiled gcc, no additional object files linked. if replace perl, rules remain same.

i'm trying create general escaping algorithm. generate .cmd file call perl output redirect. have problem if string contains odd number of double quotes escaped backslash, output redirect not function. same problem described in last comment http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx .

if use "" escape ", splits on space, result 2 parameters instead of one. "" has artifacts.

in windows there no 1 way of getting command line , parsing it. programs have been left deal themselves.

there recent post raymond chen commandlinetoargvw function mentions various rules quoting they'll apply if program uses particular function. http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx

in windows command line passed program unmolested (i.e. no wildcards expanded) , program needs deal it. programming language may provide convenience default argument parsing, , might use standard windows function commandlinetoargvw program opt read unadulterated string thereby skipping standards.

this means need figure out rules particular program trying script , use them.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -