# Run a script in the console?

**URL:** <https://www.ruby-forum.com/t/run-a-script-in-the-console/163396>\
**Category:** Rails\
**Created:** [March 19, 2009, 9:54pm UTC](https://www.ruby-forum.com/t/run-a-script-in-the-console/163396 "2009-03-19T21:54:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 9:54pm UTC](https://www.ruby-forum.com/t/run-a-script-in-the-console/163396/1 "2009-03-19T21:54:38Z")

</div>

I am trying to run a script in the script/console…but I dont think im  
doing it right. can some one help?

I am typing:

rake /lib/tasks/my\_rake\_file.rake

into the console and I get:

SyntaxError: compile error  
(irb):2: unknown regexp options - tak  
from (irb):2

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [March 19, 2009, 10:14pm UTC](https://www.ruby-forum.com/t/run-a-script-in-the-console/163396/2 "2009-03-19T22:14:08Z")

</div>

On Mar 19, 8:54 pm, Chris G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I am trying to run a script in the script/console…but I dont think im  
> doing it right. can some one help?
> 
> I am typing:
> 
> rake /lib/tasks/my\_rake\_file.rake

You’re supposed to do that from the command line. If you wanted to do  
that not from the command line then you’d need to require the rake  
gem, load that file and then look in the rake docs for how to execute  
a task programatically.

Fred

> into the console and I get:
