Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

Why am I getting is not recognized as an internal or external command error in Perl?

Hi,
I am running my Perl code with some input options. Everything run fine but at the end the code halts and it says

'\dir1\dir2\' is not recognized as an internal or external command, operable program or batch file.

Open in new window


The command that I am running is something like this:

perl \some\directory\mytool -f somefile -verbose -reportloc \dir1\dir2\

Open in new window


and this is how I define-reportloc option in GetOptions:

'reportloc=s' => \$reportLocation,

Open in new window


If I hit Ctrl+c then it exits the program just fine. But why does it hang there?

Thanks,
Avatar of Tolgar
Tolgar

ASKER

ok. I kind of found the problem.

I get the error in this line:

exec("$path2Report")

Open in new window


The equivalent of this line in Unix is:

system("xdg-open '$path2Report' > /dev/null 2>&1");

Open in new window


I use these two commands (based on the OS) to open up an HTML report in the browser.

The one in Unix works fine but in Windows I get this weird message.

Does anyone have an idea?
Avatar of ozo
What is in $path2Report?
What command does your windows system use to open up an HTML report in the browser?

'\dir1\dir2\' is not recognized as an internal or external command, operable program or batch file.
is an error message from the DOS shell                              
http://robertmarkbramprogrammer.blogspot.com/2008/01/xxx-is-not-recognized-as-internal-or.html
Avatar of Tolgar

ASKER

@ozo: $path2Report is the path to a HTML file. I use exec to open up the HTML report  on Windows.
SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial