Problem: I want to execute .bat in separate console window with output to that console window.
Solution 1:
String command = "cmd /c E:\\batFiles\\MyBat.bat";
Process pc = Runtime.getRuntime().exec(command);
Does not show output at all
Solution 2:
String command = "cmd /c E:\\batFiles\\MyBat.bat";
Process pc = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new
InputStreamReader(pc.getInputStream()));
String response;
while ((response = in.readLine()) != null) {
System.out.println("-" + response);
}
Prints to std.out- not to new dos window-
Question- what needed to direct inputStream to new console window???
Thanks