# Command line arguments ruby

**URL:** <https://rubytalk.org/t/command-line-arguments-ruby/51278>\
**Category:** ruby-talk\
**Created:** [20 January 2009 16:25 UTC](https://rubytalk.org/t/command-line-arguments-ruby/51278 "2009-01-20T16:25:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foreero\_Ivan](https://avatars.discourse-cdn.com/v4/letter/f/d9b06d/32.png) [@Foreero\_Ivan](https://rubytalk.org/u/Foreero_Ivan)\
**Post date:** [20 January 2009 16:25 UTC](https://rubytalk.org/t/command-line-arguments-ruby/51278/1 "2009-01-20T16:25:33Z")

</div>

argumentos en linea de comando  
Posted by Foreero Ivan (ivmafo)  
on 20.01.2009 17:02

Hola, me gustaria saber si existe alguna forma de generar mis propios  
argumentos en una linea de comando . Algo asi como como se usa el ARGV:

$ ruby miscript.rb --miargumento1=1 --miargumento2=2 ....

para poder usar las variables "miargumentoX" dentro de mi script ruby

Gracias de antemano....

Sorry for my poor english....  
Iwould like to know if there is any way to create my own command line  
arguments. like ARGV

something like this:

$ ruby myscript.rb --myargument1=1 --myargument2=2 ...

and use the "myargumentX" innto my script ruby

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [21 January 2009 08:10 UTC](https://rubytalk.org/t/command-line-arguments-ruby/51278/2 "2009-01-21T08:10:57Z")

</div>

You probably rather want to know how to \*parse\* command line  
arguments, don't you? In that case please have a look at  
OptionParser.

Kind regards

robert

> **···**
>
> 2009/1/20 Foreero Ivan \<ivmafo@gmail.com\>:
> 
> > Sorry for my poor english....  
> > Iwould like to know if there is any way to create my own command line  
> > arguments. like ARGV
> > 
> > something like this:
> > 
> > $ ruby myscript.rb --myargument1=1 --myargument2=2 ...
> > 
> > and use the "myargumentX" innto my script ruby
> 
> --  
> remember.guy do |as, often| as.you\_can - without end
