How to call a .exe file in a ruby program

There is a executable file named "my_app.exe" and i want to run it in my
ruby program.
How should i do?
thanks

···

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

try a system() call.

Have a look in the docs at Kernel#system .

Also have a look at the adopt-a-newbie thread.

Aur Saraf

···

On 2/15/07, yukme <yu-xiaobing@hzfuji.com> wrote:

There is a executable file named "my_app.exe" and i want to run it in my
ruby program.
How should i do?
thanks

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

Since you mention .exe I assume your on windows.

Have a look at IO.popen
http://www.ruby-doc.org/core/classes/IO.html#M002294

hth,
-Harold

···

On 2/15/07, yukme <yu-xiaobing@hzfuji.com> wrote:

There is a executable file named "my_app.exe" and i want to run it in my
ruby program.
How should i do?
thanks

Give it in back quotes as shown below

output = `my_app.exe`

···

On 2/15/07, yukme <yu-xiaobing@hzfuji.com> wrote:

There is a executable file named "my_app.exe" and i want to run it in my
ruby program.
How should i do?
thanks

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

you can also do it as

exec("my_app.exe")

exec will throw an error if the exe will not be executed, whereas
system()will return true if exe runs properly and false otherwise

···

On 2/15/07, SonOfLilit <sonoflilit@gmail.com> wrote:

try a system() call.

Have a look in the docs at Kernel#system .

Also have a look at the adopt-a-newbie thread.

Aur Saraf

On 2/15/07, yukme <yu-xiaobing@hzfuji.com> wrote:
>
> There is a executable file named "my_app.exe" and i want to run it in my
> ruby program.
> How should i do?
> thanks
>
> --
> Posted via http://www.ruby-forum.com/\.
>

--
sur
http://expressica.com