2

Path in user variable is the default path from the installation:

C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin

Path in system variable is directed to:

C:\RailsInstaller\Ruby1.9.3\bin

When I open the Command Prompt with Ruby and Rails, the command prompt says "'ruby' is not recognized as an internal or external command" immediately without any input.

The command prompt worked before. After I re-installed it using various methods due to unsuccessful setup, it got like this.

How can I fix it?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Han Qiu
  • 21
  • 1
  • 1
  • 2

4 Answers4

21

Please restart cmd before running ruby command.

Ilyas karim
  • 4,592
  • 4
  • 33
  • 47
3

In Windows PC: To add bin path of your installed ruby to PATH environmental variable 1. right click on "My Computer" -> Properties -> Advanced System Settings -> Environmental Variables -> Select "Path" ->Edit Example path shown below: D:\Ruby22\bin; 2. Restart cmd after changes

Refer below image: Ruby Path setting in Windows 7 and other windows OS

Ravistm
  • 2,163
  • 25
  • 25
1

So, C:\RailsInstaller\Ruby1.9.3.\bin is the place where your ruby.exe is saved? If that's correct, you should be able to access the ruby commands via the Command Prompt.

When you try: REG QUERY "HKCU\Environment" in the console, is there an output like?:

PATH REG_EXPAND_SZ C:\RailsInstaller\Ruby1.9.3.\bin
SirPascal
  • 11
  • 1
  • 1
    Yes the ruby.exe is saved in 'C:\RailsInstaller\Ruby1.9.3.\bin'. I'm following instruction from http://railsinstaller.org/ and I don't have a console yet. I've tried to install different version of ruby, but all of them behave the problem stated above. I'm suspecting it's command prompt's problem, since there is nothing wrong with the path. In addition, when I try to open the ruby.exe directly, it just pop up an empty command window. – Han Qiu Apr 05 '13 at 23:37
  • At the end of the installation, a window prompts up says Ruby.exe is not executable. – Han Qiu Apr 07 '13 at 02:21
  • I am receiving the same error, except that I have full access to IRB. I also tried 'set path=%path%;"c:\Program Files\Heroku\ruby\bin”' from http://stackoverflow.com/questions/9852259/ruby-exe-is-not-recognized-as-an-internal-or-external-command-in-windows-7 – Ian Steffy Mar 14 '14 at 19:44
1
  1. Ensure you have the correct x32 or x64 bit version of Ruby installed.

  2. Ensure you have the PATH environment variable setup, this should be done automatically if selected upon install.

  3. Lastly ensure you restart your command prompt.

Ruby installer

Ud0
  • 59
  • 6