# How can I load my own files to ruby? (Win XP)

**URL:** <https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223>\
**Category:** Ruby\
**Created:** [December 1, 2005, 4:29pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223 "2005-12-01T16:29:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephan.Kassel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@Stephan.Kassel](https://www.ruby-forum.com/u/Stephan.Kassel)\
**Post date:** [December 1, 2005, 4:29pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223/1 "2005-12-01T16:29:39Z")

</div>

I am just trying to get some knowledge in Ruby. For this I am playing  
with some tutorials.

In the tutorial I have to save some code to a file and load it  
afterwards in the irb (with require).

I don’t want to mess up the installation, so I am saving all files  
under my own special directory E:/User/stk/Programming/Ruby.

Which enviroment variable do I have to use? What shall I do?

There are no comments on this in the installation instructions and in  
the faq(s) afaik.

Any help is appreciated. (No, I don’t want to make a lot of other  
installations to get it done.)  
Stephan.

P.S.: I have installed ruby 1.8.2 with the OneClickInstaller on  
RubyForge.

---

<div class="post-metadata">

**Author:** ![Stephan.Kassel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@Stephan.Kassel](https://www.ruby-forum.com/u/Stephan.Kassel)\
**Post date:** [December 1, 2005, 4:45pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223/2 "2005-12-01T16:45:54Z")

</div>

On Thu, 01 Dec 2005 15:25:00 -0000, removed\_email\_address@domain.invalid  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

(I don’t know about Windows, but I expect it’s the same in this  
regard?).

If you start IRB from that directory, you should be able to require your  
file with a simple:

require ‘myfile’

assuming your file is named ‘myfile.rb’. You can also give full  
path/filename to require I think.

Alternatively, a quick and dirty way in IRB is to just do:

$: \<\< ‘E:/User/stk/Programming/Ruby’ # ?slashes?

when you first run IRB. From then, your directory will be in the library  
search path.

(Aside: Stick with it - IRB will quickly become one of the most valuable  
tools you have when learning Ruby :))

---

<div class="post-metadata">

**Author:** ![Stephan.Kassel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@Stephan.Kassel](https://www.ruby-forum.com/u/Stephan.Kassel)\
**Post date:** [December 1, 2005, 5:06pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223/3 "2005-12-01T17:06:09Z")

</div>

On Thursday 01 December 2005 09:27, removed\_email\_address@domain.invalid wrote:

> In the tutorial I have to save some code to a file and load it  
> afterwards in the irb (with require).
> 
> I don’t want to mess up the installation, so I am saving all files  
> under my own special directory E:/User/stk/Programming/Ruby.

e:  
cd User\stk\Programming\Ruby  
irb -r yourfile.rb or irb then requre ‘yourfile.rb’

Am I missing something?

---

<div class="post-metadata">

**Author:** ![Stephan.Kassel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@Stephan.Kassel](https://www.ruby-forum.com/u/Stephan.Kassel)\
**Post date:** [December 1, 2005, 5:18pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223/4 "2005-12-01T17:18:21Z")

</div>

removed\_email\_address@domain.invalid wrote:

> I am just trying to get some knowledge in Ruby. For this I am playing  
> with some tutorials.
> 
> In the tutorial I have to save some code to a file and load it  
> afterwards in the irb (with require).
> 
> I don’t want to mess up the installation, so I am saving all files  
> under my own special directory E:/User/stk/Programming/Ruby.
> 
> Which enviroment variable do I have to use? What shall I do?

The RUBYLIB environment variable lets you specify additional directories  
to be searched by ‘require’. irb picks this up. Both ruby and irb (at  
least as of 1.8.2) support a -I option too.

---

<div class="post-metadata">

**Author:** ![Stephan.Kassel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@Stephan.Kassel](https://www.ruby-forum.com/u/Stephan.Kassel)\
**Post date:** [December 1, 2005, 8:33pm UTC](https://www.ruby-forum.com/t/how-can-i-load-my-own-files-to-ruby-win-xp/49223/5 "2005-12-01T20:33:35Z")

</div>

Thank you.

This was the answer I really needed. Also many thanks to Ross to  
provide me with a quick workaround. My problem is solved. (Maybe until  
the next time when I need to know something about useful environment  
variables for ruby 😉

Regards,  
Stephan.
