# Re: Running consecutive DOS commands in Ruby

**URL:** <https://www.ruby-forum.com/t/re-running-consecutive-dos-commands-in-ruby/197289>\
**Category:** Rails\
**Created:** [September 2, 2010, 1:30pm UTC](https://www.ruby-forum.com/t/re-running-consecutive-dos-commands-in-ruby/197289 "2010-09-02T13:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srinidhi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dc4da7/32.png) [@Srinidhi](https://www.ruby-forum.com/u/Srinidhi)\
**Post date:** [September 2, 2010, 1:30pm UTC](https://www.ruby-forum.com/t/re-running-consecutive-dos-commands-in-ruby/197289/1 "2010-09-02T13:30:34Z")

</div>

Hello Everyone,

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.  
Please help me in this regard…Thanks

---

<div class="post-metadata">

**Author:** ![Srinidhi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dc4da7/32.png) [@Srinidhi](https://www.ruby-forum.com/u/Srinidhi)\
**Post date:** [September 2, 2010, 2:39pm UTC](https://www.ruby-forum.com/t/re-running-consecutive-dos-commands-in-ruby/197289/2 "2010-09-02T14:39:39Z")

</div>

On 2 September 2010 12:28, Srinidhi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello Everyone,
> 
> 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.

Put the commands in a batch file if you do not want to call them one by  
one.

> 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.

If the question is how to get them out of excel file I cannot help,  
but to put them in the command just put them in the string you are  
passing to system.

> 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.

I am confused, first you say you know how to run them one by one and  
want to do them several at one go, then you ask how to pass params to  
a batch file, then you say you want to run them one by one again.  
Obviously I am missing something.

Colin
