Search code examples
rubyrakeruby-1.9.3

ruby not working in all directories windows 10


Here is my scenario:

I have a directory I want to run rake commands. I install ruby 1.9.3. I open a new command window in the default location of C:/Users/Administrator I run ruby -v and get the response ruby 1.9.3p551 (2014-11-13) [i386-mingw32]

This is all good.

I browse to a folder and open a command window in that directory: C:/agent I run ruby -v and get the response ruby is not recognized as an internal or external command...

Ruby is installed here: C:\Ruby193\bin and this is in my %PATH%

Further when I run PATH from command line I get this:

PATH=C:\Ruby26-x64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C :\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program F iles\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\ Client SDK\ODBC\170\Tools\Binn\

But my environment system variables show this: C:\Ruby193\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;

WHy would they be different? This is why ruby works in one directory and not another, I presume


Solution

  • A full system restart fixed my path problem and as a result - no more ruby errors.