IRB help

Im new to Ruby and isntalled Rails on Windows 8. I tried typing this in IRB run it normal or as administrator and getting this result.

might have duplicated this post, first time posting on the group did not see where my post is :slight_smile:

irb(main):001:0> mkdir lesson2 NameError: undefined local variable or method lesson2' for main:Object from (irb):1 from C:/RailsInstaller/Ruby1.9.3/bin/irb:12:in ’ irb(main):002:0> cd lesson

Hi there,

The problem is that you're trying to run a command that's not a part of Ruby, but just part of the basic command tools Windows provides. When you type "mkdir lesson2", you're giving the command to create a folder named "lesson2", however, like I said, this is not part of Ruby and IRB.

Solution is to exit IRB (CTRL+D?) and then putting the command "mkdir lesson2", after which you can open IRB again to try some Ruby code.

I hope this helps! If you have any other questions, feel free to let me know :slight_smile:

You can also execute system commands from within irb using "system" system( "mkdir lesson2" ) or backticks `mkdir lesson2`

Although in the case of "mkdir" you'll probably want to use "Dir.pwd" to check you're in the right directory, and "Dir.chdir('c:/myfolder')" to move to the correct folder first.