When attempting to create a new Ruby on Rails app in Windows the command
rails new test_app
returns an error
'rails' is not recognized as an internal or external command, operable program
or batch file
but the command
rails.bat new test_app
works just fine. I have added the ..\ruby\bin directory to my PATH variable but it doesn’t seem to change anything. A similar problem occurs for all other ‘rails’ commands as well as for ‘rake’ vs ‘rake.bat’.
Running type rails.bat returns:
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"ruby.exe" "C:/_LOCALdata/Ruby192/bin/rails" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"ruby.exe" "%~dpn0" %*
From your updated question I can assume that PATHEXT, the environment variable responsible for knowing files to be executed without extensions is missing .BAT from it.
To confirm, please do
SET PATHEXTon a new command prompt and see the output, the result should be a semi-colon separated values that include.EXE,.BAT,.COMand perhaps.RBIf
PATHEXTis empty or do not contain.BATin it, that could explain why is not working.Depending on your version of Windows, the installation of RubyInstaller might have caused that, in which case I recommend uninstall and verify the environment variables to see if it get restored.
Then try to install it again.
See this thread on RubyInstaller about this.