tags:

views:

24

answers:

2

Running latest Ruby in Windows 7.

I want to be able to be able to execute code from cmd by just typing code.rb Right now I have to type ruby code.rb

Also, when I double click the code.rb file, a command prompt briefly pops up and then closes - too quick for me to read what it says.

I have tried associating .rb with ruby.exe using ftype to no avail.

Any help?

+3  A: 

Using RubyInstaller, select the checkboxes below during installation:

install

And you'll be able to do that from the command line (when in the folder, you can either type code or code.rb)

About the cmd window opening and closing really fast, I am not sure if there's a solution to that. It doesn't seem like one exists.

Aillyn
+1  A: 

If you put a gets at the very end of your code, then the command window will pause until you send a return. Then it will close.

Also, if you execute the script from the command window, it will not automatically exit.

phoffer