# Launch exe from Ruby

**URL:** <https://www.ruby-forum.com/t/launch-exe-from-ruby/140391>\
**Category:** Ruby\
**Created:** [June 13, 2008, 3:09pm UTC](https://www.ruby-forum.com/t/launch-exe-from-ruby/140391 "2008-06-13T15:09:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![melmoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@melmoth](https://www.ruby-forum.com/u/melmoth)\
**Post date:** [June 13, 2008, 3:09pm UTC](https://www.ruby-forum.com/t/launch-exe-from-ruby/140391/1 "2008-06-13T15:09:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melmoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@melmoth](https://www.ruby-forum.com/u/melmoth)\
**Post date:** [June 13, 2008, 3:15pm UTC](https://www.ruby-forum.com/t/launch-exe-from-ruby/140391/2 "2008-06-13T15:15:47Z")

</div>

On Friday 13 June 2008, Ema Fuma wrote:

> 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

---

<div class="post-metadata">

**Author:** ![melmoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@melmoth](https://www.ruby-forum.com/u/melmoth)\
**Post date:** [June 13, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/launch-exe-from-ruby/140391/3 "2008-06-13T15:24:02Z")

</div>

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

Thanks! that worked!

grazie 🙂
