D:/>netsh
Netsh>ip
Netsh>interface
Netsh interface>ip
Commands in this context:
Set address-Sets the IP or default gateway for the specified interface.
Set DNS-sets the DNS server mode and address.
Set wins-sets the WINS server mode and address.
netsh interface ip>set address
Usage: Set address [name=]
[[Source=]dhcp |
[source=] static [ADDR=]IP address [mask=]ip Subnet mask]
[[Gateway=]|none [Gwmetric=]integer]
Parameters:
Tagged value
Name-Interface names.
Source-One of the following values:
DHCP: For the specified interface, set the IP address configured with DHCP.
Static: Sets the IP address to be set using a local static configuration.
Gateway-One of the following values:
: The specified default gateway for the IP address you set.
None: Default gateway is not set.
Gwmetric-Metric for the default gateway. If the gateway is set to ' None ', this field should not be set.
The following options are set only when ' source ' is ' static ':
Addr-Specifies the IP address of the interface.
Mask-Specifies the subnet mask for the IP address.
Example: Set address name= "Local area Connection" Source=dhcp
Set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
The above is a step-by-step entry with Netsh, in fact, you can use a command directly in DOS to modify the IP address, such as:
Netsh interface IP set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
Note: The above parameters can not be omitted, the gateway does not have to write none, there is a gateway is the metric is usually written 1.
Home Ip.bat
Program code netsh interface ip delete DNS "Local Area Connection" Addr=all
netsh interface ip set address name= "Local Area Connection" Source=dhcp
Ipconfig/flushdns
Company Ip.bat
Program code
netsh interface ip delete DNS "Local Area Connection" Addr=all
netsh interface ip add DNS "Local Area Connection" addr=202.119.230.8
netsh interface ip add DNS "Local Area Connection" addr=202.106.196.115 netsh interface ip add address "Local Area Connection" 192.168.0.8 255.255.255.0
netsh interface ip add address "Local Area Connection" gateway=192.168.0.1 gwmetric=1
Ipconfig/flushdns