How do I add Ruby to the PATH variable on Windows?

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)

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-x64\bin;%PATH%

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

Consider using

 set PATH=%PATH%;C:\Ruby200-x64\bin

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.

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.

Leave a Comment