Run ruby scripts inside command prompt in windows

First you need to install ruby inside you windows system. I am assuming you have have already installed it.In place command prompt you can install ComEmu from https://conemu.github.io/

1. Now create a folder inside you drive and place your ruby scripts inside it.

example:

mkdir ruby_scripts

cd ruby_scripts

Simplest Ruby scripts is:

#!/usr/bin/env ruby

print "Enter name? "
name = gets.chomp 
puts "your #{name}!"

and save this script in sample.rb inside ruby_scripts folder. Now, run the ruby script using

ruby sample.rb
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: