i am trying to run a batch file from a perl script but i am not able to handle the return of a batch file. below is my code
perl script:
// call a batch file
my $output =system("D:\\WORKSPACE\\CC_Triggers\\batch_file.bat");
// based on output check the status of the batch file
if($output==0){
print "success in trigger**********";
}
else
{
print "FAilure**********";
}
batch file:
set "java_output="
setlocal enableDelayedExpansion
//this will call a java program and get return value.
for /f "delims=" %%J in ('java -cp "PMDfileRead.jar;jxl.jar" PMDfileRead') do (
set "java_output=!java_output! %%J"
)
endlocal & set java_output=%java_output%
// check the ouput of java and act accordingly
IF %java_output% == 1 (
echo failed
exit(1);
)else (
echo succeeded
)
basically i am trying to validate an xls file and return flag from java code which is being called by a batch file and from ther i need to return back to perl script which i am not able to get. in case of success and failure, i am getting as "0" as output due to which output is success.. request to please correct my code or suggest me the best way to handle this.