【问题标题】:how to change local machine/ethernet ip address如何更改本地机器/以太网 IP 地址
【发布时间】:2013-10-22 23:05:04
【问题描述】:

我正在尝试制作一个可以更改 pc/笔记本电脑 IP 地址和子网掩码的程序。 我尝试输入的内容与 windows 上 IPv4 属性上的接口相似(ip/subnet,dns/alternate dns)。

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

提前致谢

【问题讨论】:

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


    【解决方案1】:

    您可以在 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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-29
      • 2018-03-27
      • 2012-03-24
      • 2019-03-22
      • 2017-05-14
      • 2016-10-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多