如何在 Windows 上将 Ruby 添加到 PATH 变量中? [英] How do I add Ruby to the PATH variable on Windows?

查看:18
本文介绍了如何在 Windows 上将 Ruby 添加到 PATH 变量中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Ruby,但我仍然需要将它添加到 PATH 变量中.我在网上找到了有关如何使用命令行手动添加它的内容:

I have Ruby installed, but I still need to add it to the PATH variable. I found something online for how to manually add it using the command line:

set PATH=C:Ruby200-x64in;%PATH%

但在我尝试之前,我想确保它不会覆盖当前在 PATH 变量中的内容.(我没有这方面的经验,所以我不知道会发生什么).

But before I try it, I want to be sure it's not going to overwrite what's currently in the PATH variable. (I have no experience with this stuff so I don't know what to expect).

提前感谢您的帮助!

推荐答案

首先,请注意这个问题并不是关于 Ruby,而是关于如何在 windows 中设置路径(如果你想添加一个不同于 Ruby 的可执行文件)

first, notice that this question is not really about Ruby, rather about how to set a path in windows (it work the same way if you want to add an executable different from Ruby)

其次,您不会覆盖 PATH 环境变量,因为您将现有内容添加到您正在设置的新内容中:

second, you are not overwriting the PATH environment variable because you add the existing content of the same to the new one you are setting in:

set PATH=C:Ruby200-x64in;%PATH%

%PATH% 是 PATH 变量的当前内容.

the %PATH% is the current content of the PATH variable.

考虑使用

 set PATH=%PATH%;C:Ruby200-x64in

相反,这将使您的操作系统在搜索 ruby​​ bin 文件夹之前搜索原始路径.也许它在现代计算机上几乎没有什么区别,但我以前的 DOS 时代声称第二种解决方案更好.

instead, this will make your OS search the original path before searching the ruby bin folder. Maybe it makes few difference on modern computers, but my old DOS days claim the second solution is better.

第三点也是最后一点,在Windows中你可以在控制面板/系统属性中设置环境变量如何到达那里取决于您的操作系统版本,但如果您搜索环境变量和系统变量,您应该到达那里.

third and last point, in Windows you can set environment variables in control panel / system properties How to get there depends on the version of your OS, but if you search for the ambient variables and system variables you should get there.

这篇关于如何在 Windows 上将 Ruby 添加到 PATH 变量中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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