launch exe from Ruby

E

Ema Fuma

Hi all,
it's my first post here, so I hope I'm in the right place to ask.
I'm using Ruby for implementi a simple script, I have problem when I
want to launch an exe with as argument a path with spaces:
something like

command = "mediainfo C:\\folder1\\another folder\\file.mp4 "
IO.popen(command)

If there's a space in the path it doesn't work

command = "mediainfo C:\\folder1\\file.mp4 "
IO.popen(command)

This works,
is there something I'm missing?

Thanks a lot for any reply
Bye
 
S

Stefano Crocco

Hi all,
it's my first post here, so I hope I'm in the right place to ask.
I'm using Ruby for implementi a simple script, I have problem when I
want to launch an exe with as argument a path with spaces:
something like

command = "mediainfo C:\\folder1\\another folder\\file.mp4 "
IO.popen(command)

If there's a space in the path it doesn't work

command = "mediainfo C:\\folder1\\file.mp4 "
IO.popen(command)

This works,
is there something I'm missing?

Thanks a lot for any reply
Bye

I don't use Windows, so I can't be sure, but I think I read somewhere you need
to quote the path inside the string:

command "mediainfo \"C:\\folder1\\another folder\\file.mp4 \""

If you don't want have to escape the " inside the string, you can enclose it
in single quotes, instead:

command 'mediainfo "C:\\folder1\\another folder\\file.mp4 "'

I hope this helps

Stefano
 
E

Ema Fuma

command "mediainfo \"C:\\folder1\\another folder\\file.mp4 \""

Thanks! that worked!

grazie :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top