Closed redorav closed 3 years ago
if I remove the quotes it runs properly. I forgot to mention that this is in Windows. Interestingly, in the other platforms the quotes aren't added. What was the reason for adding them?
You need to pass each argument as a seperate part of the string, so instead of:
const char* command_line[] = { "7za.exe", "x C:/myfile.zip -oC:/mydir/ -y", nullptr };
You'd do:
const char* command_line[] = { "7za.exe", "x", "C:/myfile.zip", "-oC:/mydir/", "-y", nullptr };
I tried that, and it does indeed work. Is that something I want to do though? I wanted my arguments to be prepared elsewhere and then just sent down, as opposed to having to send all the different parts. What is the reason for those quotes? Thanks!
I can't remember all the details, but it was a requirement for Windows with something like paths iirc. It was definitely required though!
@sheredom yeah for paths (with spaces) it's probably necessary but I'd expect the user to put them in, not for everything to get wrapped. Anyway I've locally kept it without quotes as it fits how the setup works. If there's no scope to change it I may as well close :)
Hi, first of all thanks for this library, I've been looking for something nice like this for a while. I'm having an issue trying to unzip a file using 7z and I'm not sure how to fix it. I think it has to do with the way subprocess wraps things in quotes. I was hoping something like this would work:
const char* command_line[] = { "7za.exe", "x C:/myfile.zip -oC:/mydir/ -y", nullptr };
However the final command line ends up being something like:
"7za.exe" "x C:/myfile.zip -oC:/mydir/ -y"
and 7zip interprets that second part as a single argument. Is there a way for me to directly pass the arguments without adding the quotes? Would that even be the correct solution?
Thanks!