|
U can do that by creating a new process and running there the dos command.
//Creating a new process
Process p = null;
InputStreamReader isr = null;
BufferedReader br = null;
String line = null;
Runtime rt = Runtime.getRuntime();
try {
p = rt.exec("cmd");
p = rt.exec("ipconfig /all");
}
catch(IOException) {
isr = new InputStreamReader(p.getInputStream());
br = new BufferedReader(isr);
try {
line = br.readLine();
while (line != null) {
System.out.println(line);
line = br.readLine();
}
}
|