【问题标题】:Script to toggle IPV4 IP address, between the "obtain IP address automatically" settings, and a specific IP address and Subnet mask in windows cmd在“自动获取 IP 地址”设置与 Windows cmd 中的特定 IP 地址和子网掩码之间切换 IPV4 IP 地址的脚本
【发布时间】:2022-04-20 14:03:19
【问题描述】:

我正在寻找一种将 IPV4 IP 地址设置更改为特定 IP 和子网掩码的方法,同时也将其更改为自动获取 IP 地址。我在 windows cmd 中看到了大量用于设置 IPV4 IP 和 DNS 设置的资源,但我看不到在哪里可以将其更改为“自动获取 IP 地址”设置。

基本上,我需要将我的设置从默认的 IP wifi 设置快速切换到特定的 IP 地址和子网掩码(嗯,默认的,但在更改 IPV4 设置时需要设置),并在需要时切换回来。

    标签: command-line ipv4


    【解决方案1】:

    DHCP 用于自动获取 IP 地址。当您想再次将接口恢复为使用 DHCP 时,只需运行以下命令。

    netsh interface ip set address name="<adapter-name>" dhcp
    netsh interface ip set dns name="<adapter-name>" dhcp
    ipconfig /release <adapter-name> && ipconfig /renew <adapter-name>
    

    【讨论】:

      猜你喜欢
      • 2014-12-31
      • 2011-07-28
      • 2013-11-12
      • 1970-01-01
      • 2015-07-02
      • 2012-09-17
      • 2015-10-18
      • 2011-01-04
      • 2013-06-06
      相关资源
      最近更新 更多