import java.io.BufferedReader;
import java.io.InputStreamReader;
public class GetCmd {
public static void main(String[] args) {
try {
String [] cmd = {"cmd.exe","/c","dir"} ;
Process m ;
String S = "" ;
m = Runtime.getRuntime().exec(cmd) ;
BufferedReader in = new BufferedReader(new InputStreamReader( m.getInputStream()));
while((S=in.readLine()) != null) {
System.out.println(S) ;
}
}
catch(Exception ex) { ex.printStackTrace () ; }
}
}