I have this code which I wrote after searching some similar forum posts in this forum:
try {
Process p = Runtime.getRuntime().exec("cmd.exe /c start cmd.exe C:\\Users\\mm\\Documents\\NetBeansProjects\\JavaApplication1\\docs\\test.bat".split("\\s+"));
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException ex) {
ex.printStackTrace();
}
The output is that the command prompt opens up but nothing is executed (ie the ping command contained in the batch file script). I am not sure what is missing here. Previously I tried to execute directly instead of the batch file test.bat without any success.
Please help.
Thanks