@echo off set /p input=输入 set hostip=%input% netsh interface ip set address "WLAN" static 192.168.2.%hostip% 255.255.255.0 192.168.2.1 1 netsh interface ip set dns "WLAN" static 202.96.128.86 primary netsh interface ip add dns "WLAN" 202.96.128.86
说明
set /p input=输入
输入一个主机位的ip
set hostip=%input%
变量hostip赋值,引用input
netsh interface ip set address "WLAN" static 192.168.2.%hostip% 255.255.255.0 192.168.2.1 1
设置ip地址、子网掩码、网关、跳跃数
"WLAN” 网卡名称
%hostip% 引用变量
netsh interface ip set dns "WLAN" static 202.96.128.86 primary
设置主dns
netsh interface ip add dns "WLAN" 202.96.128.86 增加备用dns