![f3e711425c705f3b60fff9e18125013c.gif](https://i-blog.csdnimg.cn/blog_migrate/ded7996c59b8ff491d24970b541a5d7e.gif)
保存到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%........................................pause>nul@set /p c=:@netsh interface ipv4 set address 本地连接 static 192.168.23.%c% 255.255.252.0 192.168.23.1 >nul 2>nul@netsh interface ipv4 set dns 本地连接 static 202.96.128.86 >nul 2>nul@netsh interface ipv4 add dns 本地连接 202.96.128.166 index=2 >nul 2>nulrem echo ........................new address:%ip%........................................echo ................The ip address is set successfully. Press any key to exit. ........................................pause>nulipconfig/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.1>nulset 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!pause>nulexit) 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 **************************************************************************************************pause>nul@set /p c=:@netsh interface ipv4 set address 本地连接 static 192.168.23.%c% 255.255.252.0 192.168.23.1 >nul 2>nul@netsh interface ipv4 set dns 本地连接 static 202.96.128.86 >nul 2>nul@netsh interface ipv4 add dns 本地连接 202.96.128.166 index=2 >nul 2>nulping /n 5 127.1>nul@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 strpause>nulipconfig/all