Closed takase1121 closed 2 years ago
Happy to accept a PR.
Just ran into this as well.. weirdly, quoting "/c"
directly on the command line works, but not when run from CreateProcessA
?
Just ran into this as well.. weirdly, quoting
"/c"
directly on the command line works, but not when run fromCreateProcessA
?
That's because the quotes are intepreted by cmd
/powershell
and removed because there's no space in it.
Yeah. I'm also speechless. Apparently on Windows you MUSTN'T quote too little or too much.
The code is a bit messy, but its obvious this is your typical run of the mill
echo
example adapted for Windows. The only problem is it doesn't work.Apparently
cmd.exe
doesn't like its flags to be quoted. This library quotes every argument, so something from the above example would produce"cmd" "/c" "echo hello world"
. Perfectly fine for you and me (and sh), but for cmd... it interpreted"/c" "echo hello world"
as/c "\"echo hello world"
! Suddenly there's an extra quote there. The solution is apparentlyThis entire thing is just mind-boggling. Apparently the gold standard's
force
parameter is actually important! The only way I see to fix this problem is to not quote unescaped parameter, but I am not entirely sure (also pretty hard to do).EDIT: some potential fixes: