import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class While {
public static void main(String[] args) throws Exception{
Process p = Runtime.getRuntime().exec("aa.bat");
InputStream in = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String tmp = null;
while((tmp=br.readLine())!=null){
//这里就是你要处理的代码
//if(tmp ....
//else if(...
}
}
}
--------补充----------
这将得到 aa.bat 执行过程中回显的消息的输入流