# Difference between using irb and window promt

**URL:** <https://www.ruby-forum.com/t/difference-between-using-irb-and-window-promt/77316>\
**Category:** Ruby\
**Created:** [November 26, 2006, 10:29pm UTC](https://www.ruby-forum.com/t/difference-between-using-irb-and-window-promt/77316 "2006-11-26T22:29:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-osu3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Post date:** [November 26, 2006, 10:29pm UTC](https://www.ruby-forum.com/t/difference-between-using-irb-and-window-promt/77316/1 "2006-11-26T22:29:20Z")

</div>

Hi all,

I just write a script to change the filenames within a folder. Out of  
curiosity I want to see the differences bewteen using irb and window  
promt. I run the script from the window promt and I get what I want. But  
when I paste all the codes to irb and run from there I get error  
messages. In theory there is no defference using either irb or running  
from window promt.

Can anyone there explain it?

Thanks,

Li

I run the same script from irb first, then run it from window promt  
#########using irb  
C:\>irb  
irb(main):001:0\> path=‘C:\Ruby\self’  
=\> “C:\Ruby\self”  
irb(main):002:0\>  
irb(main):003:0\* Dir.entries(path).each do |filename|  
irb(main):004:1\*  
irb(main):005:1\* if filename=~/(LIPID5-2)(.\w+)/i  
irb(main):006:2\>  
irb(main):007:2\* open(filename).each{|line| puts line}.close  
irb(main):008:2\>  
irb(main):009:2\* new\_name=filename.gsub(/LIPID5-2/,‘LIPID5-3’)  
irb(main):010:2\> File.rename( filename,new\_name)  
irb(main):011:2\>  
irb(main):012:2\* end  
irb(main):013:1\>  
irb(main):014:1\*  
irb(main):015:1\* end  
Errno::ENOENT: No such file or directory - LIPID5-2.001  
from (irb):7:in `initialize' from (irb):7:in`open’  
from (irb):7  
from (irb):3:in `each’  
from (irb):3

######running from window promt

> ruby dir10.rb  
> 1  
> 20.0, 1433.33333333333, 2027.0  
> 2  
> 10.0, 2223.36081942031, 3440.9456549036  
> Exit code: 0
