系统变量路径在命令提示符中不同 [英] System Variable path is different in command prompt

查看:63
本文介绍了系统变量路径在命令提示符中不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了各种各样的问题,但是我整天都在与之抗争,所以请给我一些帮助:)

短篇小说:我在系统变量"面板和cmd中具有不同的PATH变量.无法运行exe文件?

更长的故事:我正在尝试安装Ruby.尝试使用不同的版本,但是问题是相同的:我拥有我的PATH值已更新,Ruby在那儿.从cmd使用时,无法识别红宝石. echo%PATH% 与环境变量"面板中的值不同!

第一个附件:环境变量"面板:

用户变量的值: 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文件(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

系统变量的值: 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:\ ProgramFiles \ 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%

我将它们与 HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment 进行比较-它们都相同.

我运行cmd并使用 echo%PATH%.结果: 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 \ b在; 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

缺少Ruby!这两者都是以管理员身份运行,而不是(实际上我只有一个管理员用户).

我尝试设置路径(通过set或setx),同时更改注册表和环境变量-没有任何效果.我尝试在有空格的路径中添加引号(")-没什么区别.

除了,如果我以管理员身份运行cmd并使用 setx PATH%PATH%; C:\ Ruby21 \ bin" !然后, echo%PATH%返回真实(更新的)路径,并且我能够运行 ruby​​ ONLY 在这个cmd中.如果我关闭它,然后以管理员身份重新打开它-更改将丢失.

请给我任何建议如何处理此问题?我只需要运行Ruby:)

Windows 7 Ultimate,Service Pack 1,64位;下载的Ruby(来自),则在安装后会创建此.bat文件并存储我当前的PATH变量.然后将它设置为我每次使用的 cmd ,因此从未更新过.您可以在这里看到我创建的问题: https://github.com/nanjingboy/nvmw/问题/5

短篇故事:检查您的 HKCU \ Software \ Microsoft \ Command Processor \ AutoRun ,并请勿使用NVMW 软件包!

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!

这篇关于系统变量路径在命令提示符中不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆