# Calling script with parameter

**URL:** <https://www.ruby-forum.com/t/calling-script-with-parameter/91043>\
**Category:** Ruby\
**Created:** [April 4, 2007, 1:48am UTC](https://www.ruby-forum.com/t/calling-script-with-parameter/91043 "2007-04-04T01:48:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x001a4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/0/b3f665/32.png) [@0x001a4](https://www.ruby-forum.com/u/0x001a4)\
**Post date:** [April 4, 2007, 1:48am UTC](https://www.ruby-forum.com/t/calling-script-with-parameter/91043/1 "2007-04-04T01:48:38Z")

</div>

Does anyone know how to call a script with a parameter?

Essentially I have a bunch of commands to run, but I only want to run  
one at a time. I’m running this script from a config file. Something  
like

```auto
$ ruby my-script.rb param1
```

---

<div class="post-metadata">

**Author:** ![0x001a4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/0/b3f665/32.png) [@0x001a4](https://www.ruby-forum.com/u/0x001a4)\
**Post date:** [April 4, 2007, 2:12am UTC](https://www.ruby-forum.com/t/calling-script-with-parameter/91043/2 "2007-04-04T02:12:29Z")

</div>

Mat Howard wrote:

> Does anyone know how to call a script with a parameter?
> 
> Essentially I have a bunch of commands to run, but I only want to run  
> one at a time. I’m running this script from a config file. Something  
> like
> 
> ```auto
> $ ruby my-script.rb param1
> ```

ARGV is what you seek. This is an Array containing all your parameters.

–  
Phillip “CynicalRyan” Gawlowski  
[http://cynicalryan.110mb.com/](http://cynicalryan.110mb.com/)

Rule of Open-Source Programming #37:

Duplicate effort is inevitable. Live with it.

---

<div class="post-metadata">

**Author:** ![0x001a4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/0/b3f665/32.png) [@0x001a4](https://www.ruby-forum.com/u/0x001a4)\
**Post date:** [April 4, 2007, 4:12am UTC](https://www.ruby-forum.com/t/calling-script-with-parameter/91043/3 "2007-04-04T04:12:16Z")

</div>

Fanatastic. That worked beautifully. Thank you very much.
