Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed the Ruby interpreter and created the file test.rb.

In the Folder Options, I created the rb file type and an action called Run and assigned the application C:\Ruby192\bin\ruby.exe "%1"" So It's possible for to get into the Windows XP command line and run the script simply by doing this:

C:\>test.rb

But when I need to send parameters to the script, I can't simply do the following:

C:>test.rb parameter1 parameter2

I'll have to do the following instead:

C:\Ruby192\bin\ruby.exe c:\test.rb parameter1 parameter2

I just noticed that I'm able to edit the action the following way to pass more parameters:

C:\Ruby192\bin\ruby.exe "%1" "%2" "%3""

That allows me to give 2 parameters to the script, but for some cases I need to pass a handful of parameters and it doesn't seem right for me to append "%5" "%6" "%7" ad nauseam.

What's the canonical way to do it?

share|improve this question
    
(Totally unrelated: I never got the point of using C:\Ruby192 instead of simply C:\Ruby or C:\Program Files\Ruby, as the default installation path... I mean, it breaks stuff even after a minor upgrade.) – grawity Mar 17 '11 at 15:51
up vote 2 down vote accepted

Just found it for the VBS files!

C:\WINDOWS\System32\WScript.exe "%1" %*

I did the same for RB files and it works!

C:\Ruby192\bin\ruby.exe "%1" %*

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .