From: Charles Calvert Date: 2010-11-11T03:55:13+09:00 Subject: Re: Can I run windows command line app interactively? On Thu, 4 Nov 2010 03:52:59 -0500, "Cai I." wrote in : >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: 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