如何用java写一个修改本机IP的小程序!!!
哪位大侠能帮下忙啊,用java怎样写出一个修改IP的程序,谢谢!!!
public class Execute
{
private static void setIP(String newip) throws Exception
{
Runtime.getRuntime().exec("netsh interface ip set addr \"本地连接\" static "+newip+" 255.255.255.0 192.168.32.1 1");
}
public static void main(String[] args) throws Exception
{
System.out.println("Begin to set the local ip address\nPlease wait...");
System.out.println("\nAfter setting the ip, the program will auto exit...");
setIP("192.168.32.100");
System.out.println("Set ip successful!");
}
}
{
private static void setIP(String newip) throws Exception
{
Runtime.getRuntime().exec("netsh interface ip set addr \"本地连接\" static "+newip+" 255.255.255.0 192.168.32.1 1");
}
public static void main(String[] args) throws Exception
{
System.out.println("Begin to set the local ip address\nPlease wait...");
System.out.println("\nAfter setting the ip, the program will auto exit...");
setIP("192.168.32.100");
System.out.println("Set ip successful!");
}
}