# What's wrong with "exec"?

**URL:** <https://www.ruby-forum.com/t/whats-wrong-with-exec/145687>\
**Category:** Ruby\
**Created:** [August 12, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/whats-wrong-with-exec/145687 "2008-08-12T23:31:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheyne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9bd4f/32.png) [@cheyne](https://www.ruby-forum.com/u/cheyne)\
**Post date:** [August 12, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/whats-wrong-with-exec/145687/1 "2008-08-12T23:31:23Z")

</div>

Hi, there

I use NETBEAN IDE 6.1. I tried to run CCC.exe by calling exec. But,  
don’t know why it keeps throwing error message,

“C:\Documents and Settings\cheynel\My  
Documents\NetBeansProjects\task1\lib\fexc.rb:8: No such file or  
directory - cannot execute (Errno::ENOENT)”

code is as following,

8 Dir.chdir(“C:\AAA\BBB”)  
9 if File.exist?(“CCC.exe”)  
10 puts “existed”  
11 end  
12 exec(“CCC.exe”)

Does any one have any idea what’s wrong here? Thanks in advance

---

<div class="post-metadata">

**Author:** ![cheyne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9bd4f/32.png) [@cheyne](https://www.ruby-forum.com/u/cheyne)\
**Post date:** [August 13, 2008, 3:36am UTC](https://www.ruby-forum.com/t/whats-wrong-with-exec/145687/2 "2008-08-13T03:36:11Z")

</div>

Cheyne Li wrote:

> 12 exec(“CCC.exe”)

Try passing the entire path of the file.exe.
