Jump to content
Tuts 4 You

Quotation marks / CreateProcess problems


LCF-AT

Recommended Posts

Hi guys,

I have some trouble again with that quotation marks issues for paths etc.Just wanna ask again how to do it right and how to handle it without to get any errors starting commandline tools with paths and arguments.I get always problems if paths using spaces and if not all works.In this case I try to qms for the path but it also fails.

Example: Below without qms for ffmpeg path so I changed the bin folder and added some spaces for testing...

cmd.exe /c C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin 1 2\ffmpeg.exe -i "https:///.....m3u8" -vcodec copy -acodec copy -f mpegts - | "C:\Program Files\VideoLAN\VLC\vlc.exe" -

Now in cmd window I get this error "Der Befehl "C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin" ist entweder falsch geschrieben oder konnte nicht gefunden werden."Wrong written or could not found.Now I try same with qms...

cmd.exe /c "C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin 1 2\ffmpeg.exe" -i "https://....m3u8" -vcodec copy -acodec copy -f mpegts - | "C:\Program Files\VideoLAN\VLC\vlc.exe" -

..and I get this error..

Der Befehl "C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Der Befehl "l" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Der Befehl "h" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

Anyhow its confusing compeletly.Normaly I would like to set all paths with qms to prevent problems if there are paths with spaces.Could anyone tell me again how to handle that correctly now using qms with CreateProcess function?I see also diffrents using ShellExecute/Ex function.At the end I would like to use just one function only and correctly.

Are there any strange rules about the qms?Or is there any function I could use to verify the qms I did set in a commandline like they above?Or any function what could set qms in a whole commandline automatically or something like that?Getting almost crazy with that qms BS each time if I try to work with comandline.Anyway,so maybe you could help again a little to fix my problem with that.

Thank you

EDIT: Only method I could use to make it simple is using GetCurrentDirectory & SetCurrentDirectory functions each time before I build and call the commandline.Seems to work so far.

greetz

Edited by LCF-AT
alternative found
Link to comment

I dont have a PC at hand to test, but I guess cmd /c takes a string, and you give it one: the "C:\...ffmpeg.exe". The "-i ...." arguments fall off the edge and are not part of the argument you pass to cmd /c for execution. Solution would be to  put QM around the whole thing. For that to work you need to escape the the QMs inside the string with \"  . As in

 

cmd.exe /c "\"C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin 1 2\ffmpeg.exe\" -i \"https://....m3u8\"  (...)"

 

I am not sure how your "- |" piping works on windows though.

Another solution would be to execute ffmpeg.exe directly and then pass it its arguments as usual.

  • Like 1
Link to comment

Hi deep,

this QM issue really sucks.Its also strange that I got this problem in a strange way using diffrent commandline tools.Also getting trouble for some if I try to load them in Olly with arguments.Also get diffrent results using CMD window directly or batch.The best is really to change the directory where the tool is stored before execute CreateProcess function.I only get that problems for the first app paramter of the tool path and for the rest arguments not also not if I use paths with spaces inside like my VLC path.Anyway,so it would  be cool if there would be any function of MSDN what could QM such cmd lines by itself as I told above.

greetz

Link to comment

I would try to resolve it in stages.

First change directory so there are no spaces to ffmpeg

"C:\FFMPEG_Sets\ffmpeg-3.3.4-win32-static\bin_1_2\ffmpeg.exe"

and just test it launches that - if it doesnt, then path is wrong, and that would need to be resolved first.

Then just add in some arguments, and test if it works

-i "https://....m3u8" -vcodec copy -acodec copy -f mpegts

Not sure what the extra - dashes are for

Then try the pipe stuff finally.

Could be easier to just call a batch file from createprocess, once the batch file has been setup and works correctly. But that also requires testing in parts to make sure it works.

 

 

  • Like 1
Link to comment

Hi fearless,

I cant change the user paths. :) Of course I can do it for me alone but not in any app I would like to release / share later you know.A batch file has also problems so there I have test it too with same commands as I use for CreateProcess.Strange is that it seems to work in most cases using ShellExecute function with such spaces paths but in this case I get error back from the pipe sign | by ffmpeg.But as I said before,at the moment I really use SetCurrentDirectory function to ffmpeg path and SetCurrentDirectory to app path right after calling CreateProcess function.The path I do use for VLC pipe which also has spaces or save paths to download files I can use with "" QM for commandline tools like  ffmpeg / streamlink & co = no problems.Maybe not the best solution to use SetCurrentDirectory each time but better as to use this strange QM rules stuff for the application & arguments.If you have  some other / better ideas than they are welcome of course.

greetz

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...