On Tue, Jul 27, 2010 at 8:43 AM, Kaye Ng <sbstn26 / yahoo.com> wrote:
> To James, I'm still on windows xp.
>
> I tried putting the calc.rb file inside the bin folder, and "ruby
> calc.rb" worked, as well as "calc" and "calc.rb"
>
> Is this what you guys were saying?
>
> The tutorial didn't say anything about the bin folder or where exactly
> to save the programs.        
> could be saved, and that's what I did.       
> "ruby calc.rb" and I got confused.
>
> I still don't understand the logic behind it.
> Do I have to bother with this?
> Do I always have to save my programs in the bin folder?
>
> Please excuse the ignorance. I'm a novice.

No problem, we were all novices at some point in time. When you type
"ruby" in the cmd window, Windows has to know to which program you
refer to. For this, it uses the environment variable PATH, which
contains a list of folders to search for executables. When you are in
any folder in your system and type the name of a program, it searches
in the current folder and then in all folders in that variable until
it finds a suitable named program to run. If it doesn't find one, it
spits the message "ruby is not recognized, etc, etc". A way to solve
it so that you can call ruby from wherever folder, is to add the path
to the ruby executable to your PATH environment variable. Others have
explained how to do that in Windows (there are some menus to click and
so on).

With this, then you can place your rb files wherever you want, and
call the ruby executable from that folder.

Hope this helps,

Jesus.