import java.io.*;
public class NewClass {
public static void main(String[] args)
{
try{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("cmd");
BufferedReader Pop = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedWriter Pin = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String newCmd;
System.out.print("Enter Command : ");
newCmd = br.readLine();
String s;
Pin.write(newCmd + " \n");
Pin.flush();
s=Pop.readLine();
while(s!=null)
{
System.out.println(s);
s = Pop.readLine();
}
Pin.close();
Pop.close();
p.destroy();
}
catch(IOException ex)
{
System.out.println(ex.toString());
}
}
}
i have created this program to execute the 'cmd' commands but after executing commands the loop is not completing can anyone suggest me how to break the loop...
Thank you....