public class Test {
public static void main(String[] args) throws IOException{
Process p = Runtime.getRuntime().exec("cmd.exe /c net start");
InputStream is = p.getInputStream();
int len = is.read();
byte[] buff = new byte[len];
is.read(buff);
FileOutputStream fos = new FileOutputStream("c://start.txt");
fos.write(buff);
System.out.println(new String(buff));
}
}
public static void main(String[] args) throws IOException{
Process p = Runtime.getRuntime().exec("cmd.exe /c net start");
InputStream is = p.getInputStream();
int len = is.read();
byte[] buff = new byte[len];
is.read(buff);
FileOutputStream fos = new FileOutputStream("c://start.txt");
fos.write(buff);
System.out.println(new String(buff));
}
}