Windows设置IP命令

来自三线的随记
Admin讨论 | 贡献2018年10月8日 (一) 09:10的版本

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.