Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.