Forum: Ruby Basic/Dumb/Beginners Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F5d08f9853f2f1baad47937f2487f5dc?d=identicon&s=25 Nicky Curzon (noogshot)
on 2016-09-29 16:47
Hi, this is a really dumb question, but I'm not sure what I'm doing
here. Any advice to help this noobian out would be great.

I've started learning Ruby from this blog -
https://pine.fm/LearnToProgram/chap_01.html

and I have a program called calc.rb to run located here
C:\Users\nonplussed\Desktop\Ruby

I've tried to run it on command prompt and ruby command prompt but it
doesn't seem to work when I type anything in?

C:\Users\nonplussed>\Desktop\Ruby calc.rb
C:\Users\nonplussed>C:\Users\nonplussed\Desktop\Ruby calc.rb
9767bd2a811cab859b83635e3636e657?d=identicon&s=25 Evgeniy Fateev (psylone)
on 2016-11-01 12:21
You should invoke ruby command itself. Something like this:

cd C:\Users\nonplussed\Desktop\Ruby
ruby calc.rb
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (rovf)
on 2016-11-08 10:50
Nicky Curzon wrote in post #1185101:
> I've tried to run it on command prompt and ruby command prompt but it
> doesn't seem to work when I type anything in?
>
> C:\Users\nonplussed>\Desktop\Ruby calc.rb
> C:\Users\nonplussed>C:\Users\nonplussed\Desktop\Ruby calc.rb

Ruby - in the same way as most other programming languages - can be
invoked on Windows in one of three ways:

(1) You specify the full path to your Ruby executable

(2) You put the path to your Ruby executable into your PATH

(3) You make an association of file extensions .rb to the Ruby
executable.

The last option, (3), is pretty Windows specific and it seems that many
people like it. I personally prefer (2). If you have more than one Ruby
installed, you should go for (1)
This topic is locked and can not be replied to.