try { Runtime run=Runtime.getRuntime(); Process p= run.exec("netsh interface ip set dns \"本地连接 6\" source=static addr=8.8.8.8"); Reader in=new InputStreamReader(p.getInputStream()); BufferedReader inb=new BufferedReader(in); while(true) { String s=inb.readLine(); if(s==null)break; System.out.println(s); } } catch (IOException e1) { e1.printStackTrace(); }
netsh interface ip set dns \"本地连接 6\" source=static addr=8.8.8.8
netsh interface ip add dns \"本地连接 6\" addr=8.8.8.8