Gán địa chỉ IP bằng Script
Mặc định "Local Area Connection" là tên của card mạng dùng để gán IP
Static IP
rem Reset network Settings for static IP
netsh interface ip set address name = "Local Area Connection" source = static addr = 10.0.0.99 mask = 255.255.255.0
netsh interface ip set address name = "Local Area Connection" gateway = 10.0.0.254 gwmetric = 1
netsh interface ip set dns name = "Local Area Connection" source = static addr = 24.222.0.1
netsh interface ip add dns name = "Local Area Connection" addr = 24.222.0.2
netsh interface ip show config
DHCP
rem Reset network settings for DHCP
netsh interface ip set address name = "Local Area Connection" source = dhcp
netsh interface ip set dns name = "Local Area Connection" source = dhcp
netsh interface ip set wins name = "Local Area Connection" source = dhcp
netsh interface ip show config