如何更改本地机器/以太网IP地址

时间:2013-10-15 08:12:07

标签: java windows vb.net dns ip-address

我正在尝试制作一个可以改变pc /笔记本电脑ip地址的程序。子网掩码。 我想要做的输入类似于Windows上的IPv4属性上的接口(ip / subnet,dns / alternate dns)。

我现在能想到的是使用netsh命令来更改windows ip。 我想要做的是在Windows上设置/获取以太网设置

提前致谢

1 个答案:

答案 0 :(得分:6)

您可以在JAVA中更改注册表,这应该可以解决问题。这些应该有所帮助:

http://www.windowsreference.com/networking/dhcp-static-ip-settings-in-windows-registry/

http://www.windowsreference.com/networking/dhcp-static-ip-settings-in-windows-registry/

其他方法是从JAVA调用netsh命令:

String str1="192.168.0.201";
String str2="255.255.255.0";
String[] command1 = { "netsh", "interface", "ip", "set", "address",
"name=", "Local Area Connection" ,"source=static", "addr=",str1,
"mask=", str2};
Process pp = java.lang.Runtime.getRuntime().exec(command1);
相关问题