Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Quickly modify IP, mask, gateway, and dns code in batch

Shulou Source: shulou.com Published: 2022-06-01 03:51:23 09月10日 Update

Save to bat

@ echo offcolor 0Etitle Big Orange Network maintenance system echo * echo * ┏┓ ┏┓ + + echo * ┏┛┻━━━┛┻┓ + + echo * ┃ ┃ echo * ┃ ━ ┃ + + + echo * ████━████ ┃ + echo * ┃ ┃ + echo * ┃ ┻ ┃ echo * ┃ ┃ + + Big Orange Network maintenance script echo * ┗━┓ ┏━┛ echo * ┃ ┃ echo * ┃ ┃ + echo * ┃ ┃ Code is far away from bug with the Animal protectingecho * ┃ ┃ + echo * ┃ ┃ echo * ┃ ┃ + bless the immortal beast Code without bugecho * ┃ ┗━━━┓ + + echo * ┃ ┣┓ echo * ┃ ┏┛ echo * ┗┓┓┏━┳┓┏┛ + echo * ┃┫┫ ┃┫┫ echo * ┗┻┛ ┗┻┛ + + echo * echo * * @ for / f "tokens=1,2* delims=:"% an in ('ipconfig ^ | findstr "IP Address"') do set ip=% % becho.. address:% IP%.. pause > nul@set / p c=:@netsh interface ipv4 set address Local connection static 192.168.23% c% 255.255.252.0 192.168.23.1 > nul 2 > nul@netsh Interface ipv4 set dns Local connection static 202.96.128.86 > nul 2 > nul@netsh interface ipv4 add dns Local connection 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

This is the first time I wrote it, but later I found that it was still a little unintelligent.

So, I improved it in my spare time.

@ echo offcolor 0Etitle big orange network maintenance system By: big orange echo * echo * ┏┓ ┏┓ + + echo * ┏┛┻━━━┛┻┓ + + echo * ┃ ┃ echo * ┃ ━ ┃ + + + echo * ████━████ ┃ + echo * ┃ ┃ + echo * ┃ ┻ ┃ echo * ┃ ┃ + + Big Orange Network maintenance script echo * ┗━┓ ┏━┛ echo * ┃ ┃ echo * ┃ ┃ + echo * ┃ ┃ Code is far Away from bug with the animal protectingecho * ┃ ┃ + echo * ┃ ┃ echo * ┃ ┃ + bless the immortal beast Code without 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=:" an 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 percent percent trunIp% (ping www.baidu.com-t-n 10echo ip set is Goodluck echo Please press Enter to exit! Pause > nulexit) else (@ echo.. IP In settings..) Echo * echo * ┏┓ ┏┓ + + echo * ┏┛┻━━━┛┻┓ + + echo * ┃ ┃ echo * ┃ ━ ┃ + + + echo * ████━████ ┃ + echo * ┃ ┃ + echo * ┃ ┻ ┃ echo * ┃ ┃ + + big orange network maintenance script echo * ┗━┓ ┏━┛ echo * ┃ ┃ echo * ┃ ┃ + echo * ┃ ┃ Code is far away from bug with the animal protectingecho * ┃ ┃ + echo * ┃ ┃ echo * ┃ ┃ + bless the immortal beast Code without bugecho * ┃ ┗━━━┓ + + echo * ┃ ┣┓ echo * ┃ ┏┛ echo * ┗┓┓┏━┳┓┏┛ + echo * ┃┫┫ ┃┫┫ echo * ┗┻┛ ┗┻┛ + + echo * echo * * pause > nul@set / p c=:@netsh interface ipv4 set address Local connection static 192.168.23% c% 255. 255.252.0 192.168.23.1 > nul 2 > nul@netsh interface ipv4 set dns Local connection static 202.96.128.86 > nul 2 > nul@netsh interface ipv4 add dns Local connection 202.96.128.166 index=2 > nul 2 > nulping / n 5 127.1 > nul@for / f "tokens=1,2* delims=:"% an in ('ipconfig ^ | findstr "IP Address"') do set ip=%%becho.... new address:%ip %.. echo others ip address is set successfully. Press any key to exit. .. goto strpause > nulipconfig/all

Tags: Oranges networks network maintenance code scripts systems smart idle for the first time or this is the gateway one button. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MariaDB vpn OPPO Reno Microsoft