# Try to run ruby on windowsxp

**URL:** <https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560>\
**Category:** Ruby\
**Created:** [January 3, 2006, 7:47am UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560 "2006-01-03T07:47:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 7:47am UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/1 "2006-01-03T07:47:39Z")

</div>

Hello all  
I tired to run this program on the command prompt of windows  
Xp  
Puts â??Hello worldâ? and I encounter the following error:

â??Puts is not recognized as internal or external command.  
Operable program or batch file â??

Please help me ,sincerely yours Mohsena

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 8:44am UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/2 "2006-01-03T08:44:29Z")

</div>

Mohsen A. wrote:

> Hello all  
> I tired to run this program on the command prompt of windows  
> Xp  
> Puts â??Hello worldâ? and I encounter the following error:
> 
> â??Puts is not recognized as internal or external command.  
> Operable program or batch file â??
> 
> Please help me ,sincerely yours Mohsena

The Windows command shell expects to be given Windows shell commands,  
not Ruby commands.

Try

ruby -e ‘puts “Hello, world!”’

(You need to give the name of the ruby interpreter so Windows knows what  
to execute, and the tell Ruby that it should execute the string that  
follows. That’s what the -e is for. )

James

–

[http://www.ruby-doc.org](http://www.ruby-doc.org) - Ruby Help & Documentation  
[Ruby Code & Style](http://www.artima.com/rubycs/) - Ruby Code & Style: Writers wanted  
[http://www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff  
[http://www.jamesbritt.com](http://www.jamesbritt.com) - Playing with Better Toys  
[http://www.30secondrule.com](http://www.30secondrule.com) - Building Better Tools

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 9:05am UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/3 "2006-01-03T09:05:42Z")

</div>

And you should use ‘puts’ instead of ‘Puts’.

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 11:36am UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/4 "2006-01-03T11:36:09Z")

</div>

Hello and thank you for your attentions ,I did all of you recommended me  
but this time it send me back this error:  
ruby is not recognized as an internal or external command,operable  
program or batch file  
sincerely yours Mohsena

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/5 "2006-01-03T18:05:39Z")

</div>

Have you installed Ruby? Use the one-click installer:  
[http://rubyforge.org/frs/?group\_id=167](http://rubyforge.org/frs/?group_id=167)

And create a new file and put this in it:

puts “Hello World!”  
gets

and save and double-click it.

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/6 "2006-01-03T20:15:32Z")

</div>

The program you’re using, “cmd” is the Windows command prompt. When you  
type in a command, it checks from two places whether that command is  
valid:

The first place is a set of commands that are inside of the program  
(such as “dir”, “cd”, et al). These commands let you look superficially  
through the filesystem.

The second place is designated by what is called a “PATH” environment  
variable. This tells the program “cmd” where to look in the filesystem  
for the programs you try to run.

The program “ruby” is not in your “PATH”. That means that the command  
prompt cannot find the program. To change this you must first know where  
you installed ruby to. In the below instructions, it is assumed you  
installed ruby to “c:\ruby”.

Choice 1: Add the ruby binary to your PATH environment variable

To change your path variable, hold down the “windows key” and press the  
“pause break” key. It’ll open up the system properties dialog. Now click  
on the “Advanced” tab. There should be an “Environment Variables”  
button. Click on it and look for “Path”. Then click “Edit”. For the  
variable value, add on to the end “;c:\ruby;c:\ruby\bin” without the  
quotes. You need the semicolons to separate the two.

Choice 2: Write a batch file (.bat file) to put somewhere in your PATH  
to run Ruby without changing your PATH environment variable

If you don’t want to add Ruby to your PATH for whatever reason, you can  
just put a batch file in a place that is already in your PATH. The  
directory “c:\windows\system32” should be in your PATH already, so go  
there and create a text document with notepad.

In the text window put the line “c:\ruby\bin\ruby.exe” without quotes  
and save it as “ruby.bat” in the “c:\windows\system32” directory. Make  
sure there’s no .txt on the end of “ruby.bat”. Now when you do what  
James B. told you above it will work.

---

<div class="post-metadata">

**Author:** ![mohsena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc348/32.png) [@mohsena](https://www.ruby-forum.com/u/mohsena)\
**Post date:** [January 3, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/try-to-run-ruby-on-windowsxp/51560/7 "2006-01-03T18:34:48Z")

</div>

Hello and thank you very much for your attention  
yes I downloaded ruby before on my computer and install it the newest  
version of it
