Better handling of command line arguments on windows (GetCommandLine)

John Arbash Meinel john at arbash-meinel.com
Sat Aug 30 15:06:56 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just came across this function in a different context: GetCommandLine() (aka
GetCommandLineW()).

http://msdn.microsoft.com/en-us/library/ms683156(VS.85).aspx

Basically, it gives you back the Unicode command line, rather than an 8-bit
one that you have to guess at the parameter encoding. This is probably mostly
useful if anyone starts spawning the process using the CreateProcess function
rather than directly.

You still need to parse it into individual arguments with the
CommandLineToArgvW function:
http://msdn.microsoft.com/en-us/library/bb776391(VS.85).aspx


I don't know how it will interfere (or not) with Python trying to interpret
the arguments as well.

I also don't know that it is a significant issue (yet). But it at least is
something we could consider.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIuVQAJdeBCYSNAAMRAgeNAKC3MVVWq6IM+D5uFsy3jmX9g2KFzACfRZYZ
x7/A2YFI755S2gQLv77gnCo=
=1G8q
-----END PGP SIGNATURE-----



More information about the bazaar mailing list