Type network configuration. netsh
#----------------------------------
# Interface IP configuration
#----------------------------------
Pushd interface IP
#
# "Local Connection" interface IP configuration
# Static IP
Set address name = "Local Connection" Source = static ADDR = 192.168.1.20 mask = 255.255.255.0
# Set the Default Gateway
Set address name = "Local Connection" Gateway = 192.168.1.1 gwmetric = 0
# Set preferred DNS
Set DNS name = "Local Connection" Source = static ADDR = 192.168.1.1 register = primary
# Device DNS
Add DNS name = "Local Connection" ADDR = 211.90.88.129 Index = 2
Set wins name = "Local Connection" Source = static ADDR = none
#
# Display the "local connection" configuration result
Show config local connection
#
# "Local Connection" interface IP configuration
# Set automatic IP address acquisition
Set address name = "Local Connection" Source = DHCP
# Set automatic DNS Retrieval
Set DNS name = "Local Connection" Source = DHCP register = primary
Set wins name = "Local Connection" Source = DHCP
#
# Display the "local connection" configuration result
Show config local connection
Popd
# End of interface IP configuration
Netsh exec network configuration. netsh
Interface "Local Connection" configuration
DHCP enabled or not
IP address 192.168.1.20
Subnet Mask 255.255.255.0
Default Gateway: 192.168.1.1
Gatewaymetric: 0
Interfacemetric 0
Static DNS server: 192.168.1.1
211.90.88.129
Static WINS server: None
Which prefix is used for registration?
DHCP has been enabled on this interface.
Interface "Local Connection" configuration
DHCP enabled is
Interfacemetric 0
DNS server configured through DHCP: 221.228.255.1
218.2.135.1
WINS server configured through DHCP: None
Which prefix is used for registration?
For more complex settings, you can use the command line to set and save the settings as a configuration file:
Netsh interface dump> network configuration. netsh
Modify the "Network Configuration. netsh" file, retain and modify the required pushd and popd segments, and the required rows in the segments.
Modify the configuration later as needed:
Netsh exec network configuration. netsh
Or
Netsh <network configuration. netsh
You can also write a BAT file:
Echo # Set static IP
Netsh interface IP Set address name = "Local Connection" Source = static ADDR = 192.168.1.20 mask = 255.255.255.0
Echo # Set the Default Gateway
Netsh interface IP Set address name = "Local Connection" Gateway = 192.168.1.1 gwmetric = 0
Echo # Set preferred DNS
Netsh interface IP Set DNS name = "Local Connection" Source = static ADDR = 192.168.1.1 register = primary
Echo # device DNS
Netsh interface IP add DNS name = "Local Connection" ADDR = 211.90.88.129 Index = 2
Netsh interface IP Set wins name = "Local Connection" Source = static ADDR = none
Echo #
Echo # display the "local connection" configuration result
Netsh interface IP show config local connection
Echo #
Echo # interface IP Address Configuration for "Local Connection"
Echo # set to automatically obtain the IP address
Netsh interface IP Set address name = "Local Connection" Source = DHCP
Echo # Set automatic DNS Retrieval
Netsh interface IP Set DNS name = "Local Connection" Source = DHCP register = primary
Echo netsh interface IP Set wins name = "Local Connection" Source = DHCP
Echo # display the "local connection" configuration result
Netsh interface IP show config local connection
Echo # End of interface IP configuration