I've seen different kind of problems around, but I'm fighting with this for a whole day, so please give me some help :)
Short story: I have different PATH variable in System Variables panel and cmd. Can't run exe files?
Longer story: I'm trying to install Ruby. Tried with different versions, but the problem is the same: I have my PATH value updated, Ruby is there. BUT when using it from cmd, ruby is not recognized. echo %PATH%
gives different value from the one in Environment Variables panel!
First attachment: Environment Variables panel:
Values for user variables:
C:\Users\morifey\nvmw\nodejs\v0.10.36;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;"C:\Program Files\Intel\WiFi\bin\";"C:\Program Files\Common Files\Intel\WirelessCommon\";"C:\Program Files (x86)\Skype\Phone\";"C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86";"C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64";"C:\Program Files\nodejs\";C:\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\bin;"C:\Program Files\TortoiseGit\bin";"C:\Program Files (x86)\Git\cmd";"C:\Program Files\Intel\WiFi\bin\";"C:\Program Files\Common Files\Intel\WirelessCommon\";C:\Users\morifey\AppData\Roaming\npm;C:\Ruby21\bin
Value for system variables:
C:\Ruby21\bin;C:\Users\morifey\nvmw\nodejs\v0.10.36;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;"C:\Program Files\Intel\WiFi\bin\";"C:\Program Files\Common Files\Intel\WirelessCommon\";"C:\Program Files (x86)\Skype\Phone\";"C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86";"C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64";"C:\Program Files\nodejs\";C:\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\bin;"C:\Program Files\TortoiseGit\bin";"C:\Program Files (x86)\Git\cmd";"C:\Program Files\Intel\WiFi\bin\";"C:\Program Files\Common Files\Intel\WirelessCommon\";"C:\Users\morifey\AppData\Roaming\npm";%SystemRoot%\system32;%SystemRoot%
I compare them to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment - they are all the same.
BUT I run cmd and use echo %PATH%
. Results:
C:\Users\morifey\nvmw\nodejs\v0.10.36;C:\ProgramData\Oracle\Java\javapath;C:\Win
dows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow
erShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Int
el\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\In
tel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C
:\Program Files\nodejs\;C:\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\b
in;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Git\cmd;C:\Program Fi
les\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users
\morifey\AppData\Roaming\npm
Ruby is missing! It's the same for both run as administrator and not (actually I have single administrator user).
I've tried setting path (via set or setx), changing both registries AND environmental variables - nothing is working. I've tried adding quotes ("
) in paths that have spaces - no difference.
Except if I run cmd as administrator and use setx PATH "%PATH%;C:\Ruby21\bin"
! Then, echo %PATH%
returns the real (updated) path, and I am able to run ruby
ONLY in this cmd. If I close it, and reopen it again as admin - changes are lost.
Please give me any kind of advise how to deal with this? I just need to run Ruby :)
Windows 7 Ultimate, Service Pack 1, 64-bit; Downloaded Ruby (from http://rubyinstaller.org/downloads/) - Ruby 2.2.2 (32 & 64 bit), Ruby 2.1.6 (32 & 64 bit) - results are all the same.
Edit: After few guys said I don't need quotes, I've removed them, and placed exactly what @eryksun said. This is the result:
C:\Users\morifey>echo %PATH%
C:\Users\morifey\nvmw\nodejs\v0.10.36;C:\ProgramData\Oracle\Java\javapath;C:\Win
dows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow
erShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Int
el\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\In
tel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C
:\Program Files\nodejs\;C:\wamp\bin\php\php5.5.12;C:\ProgramData\ComposerSetup\b
in;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Git\cmd;C:\Program Fi
les\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users
\morifey\AppData\Roaming\npm
It's pretty weird some of the inputs are repeating:
C:\Program Files\Intel\WiFi\bin\;
C:\Program Files\Intel\WiFi\bin\;
C:\Program Files\Common Files\Intel\WirelessCommon\;
C:\Program Files\Common Files\Intel\WirelessCommon\;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;
despite they are not like that in the lines I've pasted in the System Variables Path!
Update - I've used PowerShell and this script to check if there is a repetition in the system variables. I'm uploading image with the result. It's pretty strange that the path is exactly what should be, but as you can see, in CMD I see different thing!
Update - Today I tried running Ruby from PowerShell - all worked out. So it seems like only CMD doesn't know what's going on! And just to remind you - rebooting does not help! :)
Turned out to be an issue with a bat file that run each time I started cmd
, and it modified it's variables! Thanks to @eryksun and @ılǝ - it seems that in the registry (HKCU\Software\Microsoft\Command Processor\AutoRun
) you might have something like that. My problem was with nvmw package (https://www.npmjs.com/package/nvmw) that when installed, created this .bat file and stored my current PATH variable. Then it was setting it to the cmd every time I use it, and so it never got updated.
You can see the issue I've created here: https://github.com/nanjingboy/nvmw/issues/5
SHORT STORY: check your HKCU\Software\Microsoft\Command Processor\AutoRun
, and DO NOT USE NVMW package!