"Daniel Carrera" <dcarrera / math.umd.edu> wrote in message
> After ruby is installed and you've written a program, how do you run it?

Make sure that the PATH variable has C:\RUBY\BIN in it (assuming ruby is
installed on C: drive under the RUBY folder). Open up a command shell by

1.going to Start >> Run
2.entering CMD at the Open: prompt
3.and clicking OK

At the command prompt (say C:\> ) you will have to enter:
ruby  prog.rb


> When I was there I tried clicking on the program.  That caused a terminal
> to come up and show the output.  But the terminal quit right away.
>
> I tried:
>
> prompt> ruby prog.rb
>
> But Windows didn't recognize ruby as a program.

That is probably because the PATH environment system variable was NOT
modified to locate ruby.
To modify this variable
1. look for "My Computer" icon on the desktop
2. Right click and choose "Properties" from the pop-up
3. Select the "Advanced" tab
4. Click on "Environment variables"
5. In the "System Variables" list select the PATH variable
6. Click on "Edit"
7. Modify the "Variable Value"
8. Click OK repeatedly till you are out of  the dialog.
9. Close all the command shells that may be open
10. Open a new session and enter "PATH" at the prompt
11. Verify that "C:\ruby\bin" is in the semi-colon separated PATH
components.
12. If it is, then you should be able to do
       C:\>ruby -e "puts `PATH`.split(';')"
        PATH=C:\WINDOWS\system32
        C:\WINDOWS
        C:\WINDOWS\system32\WBEM
        c:\ruby\bin
        ^^^^^^^^^
This is the proof that Ruby is in the path.

I think if you install Ruby on Windows using Andy's one click installer, it
will take care of this.

> Also, is there a Windows equivalent of the '#!' line?

There is a notion of  "file associations" which is effectively the same
thing. In File Explorer if you select any file with .rb extension
1. right click to get a pop-up
2. then select "Open with" you get
3. to "Choose" Program  to "associate" the binary which will be used to open
this file type.

> Thanks for the help.

HTH,
-- shanko