Launch exe from Ruby

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

···

--
Posted via http://www.ruby-forum.com/.

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

···

On Friday 13 June 2008, Ema Fuma wrote:

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

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

Thanks! that worked!

grazie :slight_smile:

···

--
Posted via http://www.ruby-forum.com/\.