I want to return the same text that is returned when I manually type a command into the cmd prompt in Windows. Here is an example that does not work.
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
String g = "";
Runtime.getRuntime().exec(new String[] {"ipconfig", g});
System.out.println(g);
}
}
I don't know if I should be looking into Runtime.getRuntime()exec because the way I understand the api ( http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html ) is that of all of the exec examples, none return a string. The return value (if I understand right) on some is actually a 'process' which I can only guess means nothing gets returned, but the process is started. I used ipconfig in the example, but I actually need to run various diagnostic commands and analyze the string (which I have referred to as the 'cmd prompt').