-3

I'm learning Ruby using https://www.ruby-lang.org/en/documentation/quickstart/3/.

After creating the file "ri20min.rb", I can't launch it via the command. I saved it on my desktop and tried to run it. I also placed it in the "C:\RailsInstaller\scripts" and "C:\RailsInstaller\Ruby1.9.3\bin", but these didn't work either.

When I try run it at the command-line using ruby ri20min.rb it returns:

ruby: No such file or directory -- ri20min.rb (LoadError)

I think it's an error regarding where I saved the file?

2
  • 1
    You should run the command in the same library where the script is stored. So if (for example) it's "C:\temp\ri20mn.rb" then you open cmd, navigate to "C:\temp", and then type "ruby ri20mn.rb" Apr 15, 2014 at 16:46
  • this isn't a ruby on rails question. Apr 15, 2014 at 16:54

1 Answer 1

2

You're not specifying where the file is that you're trying to run. What you can do here is either navigate to the folder and run ruby ri20min.rb or just run it with the absolute path to the file specified, like ruby C:\path\to\script\ri20min.rb.

Assuming your script is in C:\RailsInstaller\scripts...

To navigate (use cd to change directory), run cd C:\RailsInstaller\scripts\ Then run ruby ri20min.rb to run the file.

Or just run the command with the absolute path. ruby C:\RailsInstaller\scripts\ri20min.rb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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