# Def is not recognized as an internal or external command

**URL:** <https://rubytalk.org/t/def-is-not-recognized-as-an-internal-or-external-command/68326>\
**Category:** ruby-talk\
**Created:** [15 August 2013 16:43 UTC](https://rubytalk.org/t/def-is-not-recognized-as-an-internal-or-external-command/68326 "2013-08-15T16:43:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [15 August 2013 16:43 UTC](https://rubytalk.org/t/def-is-not-recognized-as-an-internal-or-external-command/68326/1 "2013-08-15T16:43:37Z")

</div>

Hi,  
yesterday I installed ruby and I have tested a simple function using  
"def" keyword and it worked. Today I tried to associate .rb files to  
ruby with these commands:  
$ assoc .rb=RubyScript  
.rb=RubyScript

$ ftype RubyScript="c:\ruby\bin\ruby.exe" "%1" %\*  
RubyScript="c:\ruby\bin\ruby.exe" "%1" %\*

and I guess I messed up something cause now it throws me this error "def  
is not recognized as an internal or external command.".  
how can I solve this?

p.s. ruby -v gives me the ruby version so the ruby is installed.

Thank you!!!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Eric\_Christopherson](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/eric_christopherson/32/1849_2.png) [@Eric\_Christopherson](https://rubytalk.org/u/Eric_Christopherson)\
**Post date:** [15 August 2013 17:07 UTC](https://rubytalk.org/t/def-is-not-recognized-as-an-internal-or-external-command/68326/2 "2013-08-15T17:07:57Z")

</div>

It sounds like you're typing Ruby commands (e.g. def) at the Windows  
command line. You need to either put the commands in a .rb file and run  
that, or type irb and type the commands there. IRB is Interactive Ruby, a  
REPL.

> **···**
>
> On Thu, Aug 15, 2013 at 11:43 AM, sahar eb \<lists@ruby-forum.com\> wrote:
> 
> > Hi,  
> > yesterday I installed ruby and I have tested a simple function using  
> > "def" keyword and it worked. Today I tried to associate .rb files to  
> > ruby with these commands:  
> > $ assoc .rb=RubyScript  
> > .rb=RubyScript
> > 
> > $ ftype RubyScript="c:\ruby\bin\ruby.exe" "%1" %\*  
> > RubyScript="c:\ruby\bin\ruby.exe" "%1" %\*
> > 
> > and I guess I messed up something cause now it throws me this error "def  
> > is not recognized as an internal or external command.".  
> > how can I solve this?
> > 
> > p.s. ruby -v gives me the ruby version so the ruby is installed.
> > 
> > Thank you!!!
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [15 August 2013 18:08 UTC](https://rubytalk.org/t/def-is-not-recognized-as-an-internal-or-external-command/68326/3 "2013-08-15T18:08:26Z")

</div>

Eric Christopherson wrote in post #1118791:

> It sounds like you're typing Ruby commands (e.g. def) at the Windows  
> command line. You need to either put the commands in a .rb file and run  
> that, or type irb and type the commands there. IRB is Interactive Ruby,  
> a  
> REPL.

oops, that was it! Thank you so much @Eric!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
