Roughly switch between Ruby versions of Windows using junctions

When I wanted to verify multiple Ruby versions of Windows, I posted it because it worked by passing the path to the junction.

For example, suppose you want to verify Ruby2.6 (x86) and Ruby2.7 (x64). First, download the Ruby2.6 (x86) installer from RubyInstaller, and select C: \ Rubies \ Ruby26 as the installation destination to install it. At this time, the pass is not passed. Similarly, install 2.7 (x64) in C: \ Rubies \ Ruby27-x64.

Create the following batch file in C: \ Rubies.

use_26.bat


rmdir RubyCurrent
mklink /J RubyCurrent Ruby26

use_27_x64.bat


rmdir RubyCurrent
mklink /J RubyCurrent Ruby27-x64

Double-clicking on use_27_x64.bat creates a junction named RubyCurrent. Finally, add C: \ Rubies \ RubyCurrent \ bin to your PATH.

This allows you to switch between Ruby versions as you like by running a batch file. If you want to use Ruby2.7 (x64), double-click use_27_x64.bat, and if you want to use Ruby2.6 (x86), double-click use_26.bat.

Recommended Posts

Roughly switch between Ruby versions of Windows using junctions
Switch between multiple versions of Java on Mac
How to switch between multiple Java versions