|
From: Yuri K. <yur...@gm...> - 2014-06-24 22:11:34
|
If I understand you correctly, using single quotes is no better than using double quotes here. Both commands: $ cmd //c '"cmd" /c echo test' $ cmd //c "\"cmd\" /c echo test" produce the same command line: c:\Windows\system32\cmd.exe /c "\"cmd\" /c echo test" And they doesn't do what they are supposed to do. The point here is to pass the following command line to the process: c:\Windows\system32\cmd.exe /c ""cmd" /c echo test" AFAIR, some programs, amongst which are cmd, start, hstart, treat their command line specially. When given things like `""cmd" /c echo test"`, they just ignore the outer quotes or treat the whole thing as one big quoted argument. So, is there a way to make it so that GetCommandLine() would return exactly this: e:\showargv.exe ""c:\Program Files\foo" /k echo foo" ? > MSYS sh DTRT here,automatically inserting double quotes where needed, to keep arguments with embedded white space, or embedded special characters, intact. To be honest, it looks like MSYS sh has too much magic in it. Generally, I prefer straightforward behavior and don't like when programs make up my mind for me. Because it usually makes things more complex than they should be. But I don't know the reasoning, so I might be evidently wrong here. Regards, Yuri |