public class ExecCmd { public static void main(String args[]) { try { Process pr = Runtime.getRuntime().exec("ipconfig"); BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(), "MS950")); String line = null; while ((line = input.readLine()) != null) { System.out.println(line); } int exitVal = pr.waitFor(); System.out.println("Exit code " + exitVal); } catch (Exception e) { e.printStackTrace(); } } }---
---
---
沒有留言:
張貼留言