# Exec windows command / grab output

**URL:** <https://www.ruby-forum.com/t/exec-windows-command-grab-output/92136>\
**Category:** Rails\
**Created:** [April 16, 2007, 3:52pm UTC](https://www.ruby-forum.com/t/exec-windows-command-grab-output/92136 "2007-04-16T15:52:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drenovac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@drenovac](https://www.ruby-forum.com/u/drenovac)\
**Post date:** [April 16, 2007, 3:52pm UTC](https://www.ruby-forum.com/t/exec-windows-command-grab-output/92136/1 "2007-04-16T15:52:49Z")

</div>

I run an DB environment called OpenInsight, which is a 4GL language /  
DB.

The environment is closed, other than we can now access the database  
via the web using CGI.  
This is the command which is executed from a browser :

[http://localhost/cgi-bin/oecgi2.exe/inet\_Trace](http://localhost/cgi-bin/oecgi2.exe/inet_Trace)

and it works perfectly.  
I have tried to replicate this in ruby - and cannot.

I’ve tried exec, but that kills all sessions as it appears to fork and  
then exit

I’ve tried system(‘dir’) to attempt to trial how this might work, but  
cannot capture the output.  
And, I’ve had better luck with system - other than it returns true /  
false - not the results.

How can I setup and create a RUBY environment so that I can exec the  
OECGI2.exe from a browser / passing it params - the /inet\_Trace is the  
name of a function that the DB executes, and this does work in all  
environments.  
Apache is used as the web server.

Cheers
