From: Robert Klemme Date: 2010-09-02T21:50:09+09:00 Subject: Re: Running consecutive DOS commands in Ruby On Thu, Sep 2, 2010 at 1:35 PM, Srinidhi wrote: > I have a situation where  i have to invoke command line tools like > putty_sftp and OpenSSH from ruby script for automation, as out > application handles sftp uploads through these tools. > So the problem is i can single DOS command in ruby and store the > output(using system( ),exec( )), but here were are talking abt > multiple DOS commands to achieve the goal. > Also i have to pick up values like user id and password from excel > file(which i am doing using ruby).I have to know how to pass these > value to DOS batch file from ruby. > > It would be a boon if i can all the DOS commands in my ruby program > one by one, so it's easy to parametrize variables without much. What version of DOS are we talking about? Do current versions of Ruby run on DOS at all? In case you happen on a POSIX system you could use IO.popen to start a shell (say "/bin/sh"), issue commands and use Ruby's expect call to evaluate output / replies. You could as well create a script in memory and feed it to the shell in one go but then you cannot react on command outputs or have to generate the decision logic into the script. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/