It seems to me that the way the cmd.exeWindows string argument string is different from the way the C-compiled exe does it.
To illustrate, it cmd /C "echo ok"prints "ok" correctly. But cmd "/C" "echo ok"leads to
'"echo ok' is not recognized as an internal or external command,
operable program or batch file.
For comparison, here is the C program, CommandArguments.c, which prints the arguments in turn:
int main(int argc, char *argv[])
{
int i;
for (i = 0; i < argc; ++i) {
printf("%s\n", argv[i]);
}
}
If I run CommandArguments.exe "/C" "echo ok", it prints correctly
CommandArguments.exe
/C
echo ok
I ask about this because I am implementing an API for porting CreateProcess. I quote and avoid all input arguments before moving on to CreateProcess. It works for most things, but not because cmdof the above problem.
, , cmd -? ? , -?