On Thu, 4 Nov 2010 03:52:59 -0500, "Cai I." <cai.inception / gmail.com> wrote in <ea0055cfedb122c2ed0424aaf5e406c0 / ruby-forum.com>: >I want to do something like this: > > # open a session > @session = IO.popen('cmd.exe', 'r+') > > # run a command and process outputs > @session.puts('dir') > @session.each do |line| > p line > end > > # run a command line application > @session.puts('robocopy.exe ......') > @session.each do |line| > p line > end You can do this, but you'll need to use the Win32 API to attach to a console (command shell) and be able to read and write to its STDIN and STDOUT. See the links below: <http://www.dreamincode.net/code/snippet921.htm> <http://www.halcyon.com/~ast/dload/guicon.htm> <http://msdn.microsoft.com/en-us/library/ms681944%28VS.85%29.aspx> The first two are links to examples, and the last is to the MSDN documentation. It's been a number of years since I did this, but it's the technique that Visual Studio uses to run the command-line compilers and pipe their output back into the IDE. -- Charles Calvert | Software Design/Development Celtic Wolf, Inc. | Project Management http://www.celticwolf.com/ | Technical Writing (703) 580-0210 | Research