[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

launch exe from Ruby

Ema Fuma

6/13/2008 1:09:00 PM

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-....

2 Answers

Stefano Crocco

6/13/2008 1:14:00 PM

0

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

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

Ema Fuma

6/13/2008 1:23:00 PM

0

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

Thanks! that worked!

grazie :-)
--
Posted via http://www.ruby-....