因此,我编写了一个简单的批处理文件来设置静态 IP,然后将其反映回控制台:
@echo off
netsh interface ipv4 set address "Local Area connection" static 192.168.1.100 255.255.255.0 192.168.1.1
netsh interface ipv4 set dnsserver "Local Area Connection" static 8.8.8.8
netsh interface ipv4 add dnsserver "Local Area Connection" 8.8.4.4
netsh interface ipv4 show config "Local Area Connection"
pause
但是控制台的输出是这样的:
Configuration for interface "Local Area Connection"
DHCP enabled: No
Default Gateway: 192.168.1.1
Gateway Metric: 1
InterfaceMetric: 20
Statically Configured DNS Servers: 8.8.8.8
8.8.4.4
Register with which suffix: Primary only
Statically Configured WINS Servers: None
Press any key to continue . . .
为什么它不显示我静态分配的 IP 地址?