Irb not recognized in windows command line

I’m reading Beginning Ruby and followed the installation process , using
the one-click installer for Windows from Ruby Forge. I successfully
loaded fxri.
Received the following message after typing irb in the Windows command
prompt:

‘irb’ is not recognized as an internal or external command, operable
program or batch file.

Any suggestions on how to get this working will be greatly appreciated.

Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you’ll need to add it. You might also check, just to make sure
ruby
itself is operable, ‘ruby -v’ at the command line.

HTH,
Bill

----- Original Message -----

Bill W. wrote:

Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you’ll need to add it. You might also check, just to make sure
ruby
itself is operable, ‘ruby -v’ at the command line.

HTH,
Bill

----- Original Message -----

Thank you, Bill!

As you can probably tell, I’m not a programmer. I thought the paths
would be created automatically since the author of Beginning Ruby just
said to type irb at the command prompt to get irb(main):001:0> and this
will shows it’s installed correctly.

When I enter Ruby commands into fxri, the expected results appear, so
that is set up correctly.

How would I create a path to ruby/bin? The books I have do not go into
paths unfortunately.

Bert

Bill W. wrote:

Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you’ll need to add it. You might also check, just to make sure
ruby
itself is operable, ‘ruby -v’ at the command line.

HTH,
Bill

----- Original Message -----

I forgot to mention that ‘ruby -v’ does not work either - get the same
message “ruby” is not recognized.

Bert A. wrote:

I forgot to mention that ‘ruby -v’ does not work either - get the same
message “ruby” is not recognized.

Your path has nothing to do specifically with Ruby. It’s part of the way
Windows command prompt windows work. Your path is a list of directories.
When you enter a command at a command prompt, if the command is not
built into Windows itself (like dir, or chdir), then Windows searches
for the command in the directories listed in your path. You can make
temporary changes to your path using the SET PATH= command, or permanent
changes via the System tab in Control Panel.

When you install Ruby using the One-Click Installer, the installer
changes your path to include the directory in which it installs the ruby
and irb commands. That change does not affect existing command prompt
windows, it only affects command prompt windows that you start after
running the One-Click Installer. If you continue to use an command
prompt window that was open before you used the One-Click Installer,
then that window is still using the old path and therefore can’t find
ruby or irb.

If you haven’t started a new command prompt window since you installed
Ruby, close all of the command prompt windows you have open now and
start a new one. The new path will be in effect and you should be able
to run ruby and irb.

Here’s more information about the path. It’s for WinXP but I think
things are very similar in Vista:
How to Set the Path and Environment Variables in Windows.

Bert A. wrote:

I forgot to mention that ‘ruby -v’ does not work either - get the same
message “ruby” is not recognized.

Maybe helpful, maybe not:

Are you using a command prompt window that was open before you installed
ruby? If so, try opening a new window. The environment variable settings
performed by the installer (such as the PATH to search for executable
programs) will not take effect retroactively.

Joel VanderWerf wrote:

Bert A. wrote:

I forgot to mention that ‘ruby -v’ does not work either - get the same
message “ruby” is not recognized.

Maybe helpful, maybe not:

Are you using a command prompt window that was open before you installed
ruby? If so, try opening a new window. The environment variable settings
performed by the installer (such as the PATH to search for executable
programs) will not take effect retroactively.

Thanks so much, Joel. I got it working in the meantime by uninstalling
Ruby and installing Instant Rails.

Tim H. wrote:

Bert A. wrote:

I forgot to mention that ‘ruby -v’ does not work either - get the same
message “ruby” is not recognized.

Your path has nothing to do specifically with Ruby. It’s part of the way
Windows command prompt windows work. Your path is a list of directories.
When you enter a command at a command prompt, if the command is not
built into Windows itself (like dir, or chdir), then Windows searches
for the command in the directories listed in your path. You can make
temporary changes to your path using the SET PATH= command, or permanent
changes via the System tab in Control Panel.

When you install Ruby using the One-Click Installer, the installer
changes your path to include the directory in which it installs the ruby
and irb commands. That change does not affect existing command prompt
windows, it only affects command prompt windows that you start after
running the One-Click Installer. If you continue to use an command
prompt window that was open before you used the One-Click Installer,
then that window is still using the old path and therefore can’t find
ruby or irb.

If you haven’t started a new command prompt window since you installed
Ruby, close all of the command prompt windows you have open now and
start a new one. The new path will be in effect and you should be able
to run ruby and irb.

Here’s more information about the path. It’s for WinXP but I think
things are very similar in Vista:
How to Set the Path and Environment Variables in Windows.

Thanks you very much, Tim!

I actually uninstalled Ruby in the meantime and installed InstantRails.
It’s working now.

Just for anybody still looking solution having no admin rights in WinXP:

Start
-> Control Panel
-> System
-> Advanced
-> Environment Variables
-> New for User Variables
-> Variable Name: Path, Variable Value: C:\ruby\bin (if installed in
this folder).