Executando comando no SO por java

Alguem sabe como executo comando no DOS em java e pego a saida dele?

Pesquisa sobre Runtime…

é algo mais ou menos assim:

Runtime runtime = Runtime.getRuntime();
runtime.exec(seuprograma);

Falou!

Sei que da pra executar comandos :

try {
  Runtime.getRuntime().exec("net send inf-leandro teste");
} catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
}

Mas pra pegar a saida não sei não…

Valeu galera eu achei :stuck_out_tongue:

pra pegar a saida tb fiz isso tb:

InputStreamReader ir = new InputStreamReader(Runtime.getRuntime().exec("net view").getInputStream());
reader = new BufferedReader(ir);

[]'s