Netsh 批处理文件,不会记住网关

Netsh 批处理文件,不会记住网关

我正在制作一个小批处理文件来更改一些网络适配器设置:

有人能解释一下为什么这样做有效吗:

netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.11 255.255.255.0 192.168.1.1

然而这不行(它修改了 IP、子网,但没有对网关进行任何更改):

set /p FIRSTIP=Please type the IP address provided: 
set /p SUBNETIP=Please type the Subnet IP provided: 
set /p DFTGATEWAY=Please type the Gateway provided: 

netsh interface ipv4 set address name="Local Area Connection" static %FIRSTIP% %SUBNETIP% %GATEWAY%

这是在 Windows 10 机器上。我一直在为此绞尽脑汁,大多数知识库文章似乎都没有什么帮助。

相关内容