Hi All,
I need to execute a batch file from
java, below is the code snippet
Runtime rt = Runtime.getRuntime();
Process pr=rt.exec("cmd /C start D:\\batchRun\\test.bat");
int exitValue=pr.exitValue();
I am able to successfully execute the batch file, but i have a few concerns,
1. Also when the batch is completed successfully i want to know if it there were any errors in the batch execution. I tried using
pr.exitValue() and pr.waitFor(), but in both cases, even if i explicity close the command propmt i still obtain exitValue as 0.
If there anyways where i can get to know whether batch file completed without errors.
2. How to execute batch file silently in the background without cmmmand prompt getting open. I removed cmd /C start and it works fine,
but this behaviour is not consistent in different OS.
Thanks,