Question

I have the following exec statement:

    $script_dir = 'C:\Users\mcnall\Documents\main_home\script';

    exec("$script_dir\\exec.pl", "$name", "$func_type", "$func_args");

When reaching this line, the error

Can't exec "C:\Users\mcnall\Documents\main_home\script\exec.pl": No such file or directory at C:\Users\mcnall\Documents\main_home\script\main.pl line 153.

The file definitely exists. When I copy and paste C:\Users\mcnall\Documents\main_home\script\exec.pl from the error above it runs the file as expected, it will just not run it through the script for some reason..

I must be doing something stupid, can someone please give me a tip as to what I am doing wrong?

Was it helpful?

Solution

As mpapec suggested in the comments, you need to specify perl.exe as your first argument:

exec("C:\\Perl\\bin\\perl.exe", "$script_dir\\exec.pl", ....... );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top