Windows设置IP命令

来自三线的随记

netsh

netsh interface ip set address "以太网 5" static 192.168.62.5 255.255.255.0 192.168.62.254

netsh interface ip set address "以太网 5" dhcp

powershell

Get-NetIPInterface 获取index

New-NetIPAddress -InterfaceIndex 17 -IPAddress 192.168.62.5 -PrefixLength 24 -DefaultGateway 192.168.62.254

Set-NetIPAddress -InterfaceIndex 17 -IPAddress 192.168.0.1 -PrefixLength 24

powershell --> comment

The Set-NetIPAddress cmdlet modifies IP address configuration properties of an existing IP address.

To create an IPv4 address or IPv6 address, use the New-NetIPAddress cmdlet.

/*设置IP和更改IP还分开了?令人窒息*/