How can I execute Ruby scripts and irb from Windows7 Powershell?

I used the Windows Ruby installer, and all I can do is run ruby โ€‹โ€‹from a regular command line using the associated shortcut called "Command line with ruby."

Windows 7 Powershell is a good replacement for bash, so I would like to be able to run Ruby, irb, gem, etc. At least the execution of scripts ...

I read that it is possible, how?

+6
source share
2 answers

Is the directory where Windows Ruby Installer is installed (e.g. C: \ Ruby192 \ bin) in your path? I canโ€™t remember whether to add this automatically during installation, but I had no problems with irb or scripts from powershell. You can check if this is in your path by running the following from a powershell session:

$env:path 
+3
source

I did this so change the directory to the place where Ruby is installed (in my case it is C: \ Ruby193 \ bin)

 C:\Users\admin>cd C:\Ruby193\bin 

and there just type irb and hit enter:

 C:\Ruby193\bin>irb irb(main):001:0> 1+4 => 5 irb(main):002:0> 
+2
source

Source: https://habr.com/ru/post/893090/


All Articles