Pages

Thursday, July 8, 2010

Execute RUBY program on Command Prompt

Ruby is an object-oriented interpreted scripting language.

Download Ruby -One-Click Installer (old) - ruby186-27_rc2.exe

Know about Ruby by having a look at the below links
http://www.ruby-lang.org/en/about/
http://www.techotopia.com/index.php/What_is_Ruby%3F

Simple steps for executing a tiny ruby program in command prompt.

1. Write a simple program & save the file as “welcome.rb
Code: puts "Welcome ==> RUBY !"

2. Set Ruby on Path as follows :
C:\ruby\prg>set path=%path%;c:\ruby\bin

3.To excute the program give the filename with .rb extension suffix to the word ruby
C:\ruby\prg>ruby welcome.rb

4.Add .rb to the PATHEXT environment variable as follows:
C:\ruby\prg>set PATHEXT=.rb;%PATHEXT%

5.Once the above settings are configured simply run the program by typing the filename at the command prompt (the .rb filename extension is not required):
C:\ruby\prg> welcome

Command Prompt code

No comments:

Post a Comment