系统变量路径在命令提示符中不同

And*_*pov 10 ruby windows registry cmd environment-variables

我已经看到了各种各样的问题,但是我和这个问题争了一整天,所以请给我一些帮助:)

简短的说明:我在System Variables面板和cmd中有不同的PATH变量.无法运行exe文件?

更长的故事:我正在尝试安装Ruby.不同版本的尝试,但问题是相同的:我我的路径值更新,红宝石是存在的.但是当从cmd使用它时,无法识别红宝石.echo %PATH% 给出Environment 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

对于值系统变量: 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%

我将它们与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:\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缺失了!对于以管理员身份运行而不是(实际上我有单个管理员用户),它是相同的.

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

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

请给我任何建议如何处理这个?我只需要运行Ruby :)

Windows 7旗舰版,Service Pack 1,64位; 下载的Ruby(来自http://rubyinstaller.org/downloads/) - Ruby 2.2.2(32和64位),Ruby 2.1.6(32和64位) - 结果完全相同.


编辑:在几个人说我不需要引号之后,我已经删除了它们,并准确地放置了@eryksun所说的内容.这是结果:

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

一些输入正在重复是非常奇怪的: 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; 尽管它们不像我在系统变量路径中粘贴的那些行!


更新 - 我使用PowerShell和脚本来检查系统变量是否重复.我正在上传带有结果的图片.这条道路应该是应该的,这很奇怪,但正如你所看到的,在CMD中,我看到了不同的东西!

在此输入图像描述


更新 - 今天我尝试从PowerShell运行Ruby - 一切顺利.所以似乎只有CMD不知道发生了什么!只是提醒你 - 重启没有帮助!:)

And*_*pov 5

结果是每次我启动时运行的bat文件出现问题cmd,并且它修改了它的变量!感谢@eryksun和@\xc4\xb1l\xc7\x9d - 看来在注册表(HKCU\\Software\\Microsoft\\Command Processor\\AutoRun)中你可能有类似的东西。我的问题是nvmw包(https://www.npmjs.com/package/nvmw)在安装时创建了这个 .bat 文件并存储了我当前的 PATH 变量。然后每次我使用它时它都会将其设置为 cmd ,因此它从未更新。\n您可以在此处查看我创建的问题: https: //github.com/nanjingboy/nvmw/issues/5

\n\n

简短故事:检查您的HKCU\\Software\\Microsoft\\Command Processor\\AutoRun不要使用 NVMW软件包!

\n