JAV 修改本地IP代码
View Code
1 import java.io.IOException; 2 3 4 public class IP1 { 5 public static void main(String[] args) { 6 String str="netsh interface ipv4 set address name=本地连接 source=static addr=172.16.101.145 mask=255.255.255.0 gateway=172.16.101.254 gwmetric=0"; 7 8 try { 9 Runtime.getRuntime().exec(str); 10 11 } catch (IOException e1) { 12 13 e1.printStackTrace(); 14 } 15 } 16 17 }