# Newby\>\> Ruby and method Gets... and Windows

**URL:** <https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690>\
**Category:** Ruby\
**Created:** [April 2, 2006, 11:31pm UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690 "2006-04-02T23:31:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 2, 2006, 11:31pm UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/1 "2006-04-02T23:31:06Z")

</div>

Hi,

i’m under Windows XP SP2 and i installed OneClick Installer. So, i began  
to  
read some documentations and i learnt to use the gets’s method.

So nothing hard in that, i wrote my program in SciTE:

puts “Hi what’s your name?”  
nom = gets  
puts "OK Hi " + nom

But it don’t work. A windows with “c:\ruby\bin\ruby.exe” in the titlebar  
appear but i can’t write anything in it. Nothing. So i close the windows  
and  
in SciTE i have it:  
Exit code: -1073741510

Can you help me please? And please, don’t tell me i have to work under  
Linux  
;o)

Thanks

Alex

---

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 2, 2006, 11:58pm UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/2 "2006-04-02T23:58:33Z")

</div>

Well don’t worry you don’t have to switch to Linux.  
When running programs which use “gets”, you have to use your command  
line.

2006/4/2, Alex [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 3, 2006, 1:05am UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/3 "2006-04-03T01:05:18Z")

</div>

Alex wrote:

> Hi,
> 
> i’m under Windows XP SP2 and i installed OneClick Installer. So, i began to  
> read some documentations and i learnt to use the gets’s method.
> 
> So nothing hard in that, i wrote my program in SciTE:

Don’t use SciTE. It isn’t part of Ruby. Use your favorite text  
editor (even Notepad). Save the program as “name.rb” and run it  
from the DOS prompt with

ruby name.rb

(To open a DOS prompt, click on  
Start / Programs / Accessories / Command prompt.)

---

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 3, 2006, 1:14am UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/4 "2006-04-03T01:14:25Z")

</div>

Or you can still use SciTE to get the syntax coloring, but follow  
William’s  
advice by only running your scripts in DOS.

---

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 3, 2006, 10:11am UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/5 "2006-04-03T10:11:54Z")

</div>

Hi,

thanks for your answer, actually, i found it after my message. But on  
Windows, in command prompt, you have to be in the directory which  
contain  
the program.  
I havec to type:  
cd   
cd mysampledir\ex1  
ruby name.rb

And it works!

Thanks

---

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [April 3, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/newby-ruby-and-method-gets-and-windows/56690/6 "2006-04-03T13:55:28Z")

</div>

I have found just the same thing myself… You can use SciTE to write  
the ruby program, and do make sure you give it a .rb extenstion, and do  
make sure that you save it before running it. But when is comes to  
running it you should run it from inside the command prompt, not from  
inside sciTE. If the program has no lines in it using gets then it will  
probably run in SciTE, but if you are using gets then run it in the  
cmd prompt.  
The other interesting things are :  
1 what if you want to put the ruby program in to a part of rails, and  
where and how to do this…  
You can put ruby code into parts of rails but you should surround the  
ruby code with \<%= and %\> I think, and of course you must have a ruby  
server running on the machine that you have the file on, otherwise no  
ruby code will be interprested at all!
