脚本以切换IPv4 IP地址,在“自动获取IP地址”之间设置,以及Windows CMD中的特定IP地址和子网掩码

发布于 2025-01-22 13:40:02 字数 210 浏览 2 评论 0原文

我正在寻找一种将IPv4 IP地址设置更改为特定IP和子网掩码的方法,但也将其更改以自动获取IP地址。我看到了很多用于在Windows CMD中设置IPv4 IP和DNS设置的资源,但是我看不到在哪里可以将其更改为“自动获取IP地址”设置。

基本上,我需要快速将设置从默认的IP WiFi设置转换为特定的IP地址和子网蒙版(嗯,默认设置,但是在更改IPv4设置时需要设置它),并在需要时返回。

I am looking for a way to change the IPV4 IP address settings to a specific IP and Subnet mask, but also to change it to get the IP address automatically. I see plenty of resources for setting the IPV4 IP and DNS settings in windows cmd, but I don't see where i can change it to the "Obtain IP address automatically" setting.

Basically, I need to quickly switch my settings from the default IP wifi settings to a specific IP address and subnet mask (well, the default one, but it needs to be set when changing IPV4 settings), and back when I need it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟雨扶苏 2025-01-29 13:40:02

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>

DHCP is used to obtain IP address automatically. When you'd want to revert the interface to using DHCP again, just run the following commands.

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文