如何批量修改机房的ip地址(批量快速一键修改IP,掩码,网关,以
怎么修改DNS地址 批量快速一键修改IP,掩码,网关,以及dns代码
保存到bat
@echo offcolor 0Etitle 大橘子 维护系统echo echo ┏┓ ┏┓+ +echo ┏┛┻━━━┛┻┓ + +echo ┃ ┃echo ┃ ━ ┃ ++ + + +echo ████━████ ┃+echo ┃ ┃ +echo ┃ ┻ ┃echo ┃ ┃ + + 大橘子 维护脚本echo ┗━┓ ┏━┛echo ┃ ┃echo ┃ ┃ + + + +echo ┃ ┃ Code is far away from bug with the animal protectingecho ┃ ┃ + echo ┃ ┃echo ┃ ┃ + 神兽保佑,代码无bugecho ┃ ┗━━━┓ + +echo ┃ ┣┓echo ┃ ┏┛echo ┗┓┓┏━┳┓┏┛ + + + +echo ┃┫┫ ┃┫┫echo ┗┻┛ ┗┻┛+ + + +echo echo @for /f \"tokens=1,2 delims=:\" %%a in ('ipconfig ^|findstr \"IP Address\"') do set ip=%%becho ............................address%ip%........................................pausegtnul@set /p c=:@netsh interface ipv4 set address 本地连接 static 192.168.23.%c% 255.255.252.0 192.168.23.1 gtnul 2gtnul@netsh interface ipv4 set dns 本地连接 static 202.96.128.86 gtnul 2gtnul@netsh interface ipv4 add dns 本地连接 202.96.128.166 index=2 gtnul 2gtnulrem echo ........................new address%ip%........................................echo ................The ip address is set successfully. Press any key to exit. ........................................pausegtnulipconfig/all
这是我之一次写的,后来发现还是有些不太智能。
于是,我在空闲之余又对其进行了一下改进
@echo offcolor 0Etitle 大橘子 维护系统 By大橘子echo echo ┏┓ ┏┓+ +echo ┏┛┻━━━┛┻┓ + +echo ┃ ┃echo ┃ ━ ┃ ++ + + +echo ████━████ ┃+echo ┃ ┃ +echo ┃ ┻ ┃echo ┃ ┃ + + 大橘子 维护脚本echo ┗━┓ ┏━┛echo ┃ ┃echo ┃ ┃ + + + +echo ┃ ┃ Code is far away from bug with the animal protectingecho ┃ ┃ + echo ┃ ┃echo ┃ ┃ + 神兽保佑,代码无bugecho ┃ ┗━━━┓ + +echo ┃ ┣┓echo ┃ ┏┛echo ┗┓┓┏━┳┓┏┛ + + + +echo ┃┫┫ ┃┫┫echo ┗┻┛ ┗┻┛+ + + +echo echo ping /n 2 127.1gtnulset Num=100set N=0:strset /a n=%n%+1if \"%n%\"==\"%Num%\" goto end@for /f \"tokens=1,2 delims=:\" %%a in ('ipconfig ^|findstr \"IP Address\"') do set ip=%%becho ............................address%ip%........................................rem echo %ip:~0,11%set trunIp=%ip:~0,11%rem echo %trunIp%if 192.168.23==%trunIp% (ping www.baidu.com -t -n 10echo ip set is Good!echo Please press Enter to exit!pausegtnulexit) else (@echo ......................................IP In settings........................................) echo echo ┏┓ ┏┓+ +echo ┏┛┻━━━┛┻┓ + +echo ┃ ┃echo ┃ ━ ┃ ++ + + +echo ████━████ ┃+echo ┃ ┃ +echo ┃ ┻ ┃echo ┃ ┃ + + 大橘子 维护脚本echo ┗━┓ ┏━┛echo ┃ ┃echo ┃ ┃ + + + +echo ┃ ┃ Code is far away from bug with the animal protectingecho ┃ ┃ + echo ┃ ┃echo ┃ ┃ + 神兽保佑,代码无bugecho ┃ ┗━━━┓ + +echo ┃ ┣┓echo ┃ ┏┛echo ┗┓┓┏━┳┓┏┛ + + + +echo ┃┫┫ ┃┫┫echo ┗┻┛ ┗┻┛+ + + +echo echo pausegtnul@set /p c=:@netsh interface ipv4 set address 本地连接 static 192.168.23.%c% 255.255.252.0 192.168.23.1 gtnul 2gtnul@netsh interface ipv4 set dns 本地连接 static 202.96.128.86 gtnul 2gtnul@netsh interface ipv4 add dns 本地连接 202.96.128.166 index=2 gtnul 2gtnulping /n 5 127.1gtnul@for /f \"tokens=1,2 delims=:\" %%a in ('ipconfig ^|findstr \"IP Address\"') do set ip=%%becho ........................new address%ip%........................................echo ................The ip address is set successfully. Press any key to exit. .........................................goto strpausegtnulipconfig/all
自动获取的ip地址怎么修改dns ip地址不变如何批量修改子网掩码