日期:2014-05-20 浏览次数:20815 次
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class GetCmd {
private InputStream is=null;
;
public static void main(String args[]) throws IOException
{
OutputStream os=null;
String command=null;
ProcessBuilder pb=new ProcessBuilder("C://Windows//System32//cmd.exe");
Process p=pb.start();
Scanner s=new Scanner(System.in);
System.out.println("welcome come to my cmd ");
String res=null;
BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
os=p.getOutputStream();
res=br.readLine();
System.out.println(res);
while((res=br.readLine())!= null)
{
System.out.println(res);
}
System.out.println("debug");
}
}