• B606 ChangeNet


     1 @echo off
     2 Setlocal Enabledelayedexpansion
     3 title B606 ChangeNet
     4 
     5 echo Checking...
     6 
     7 set inside=F&set outside=F
     8 for /f "delims=" %%i in ('ipconfig ^| findstr /c:"192.168.208"') do set inside=T
     9 for /f "delims=" %%i in ('ipconfig ^| findstr /c:"172.16.35"') do set outside=T
    10 
    11 :loop
    12 set ipld=%random%
    13 if !ipld! LSS 100 goto :loop
    14 if !ipld! GTR 200 goto :loop
    15 
    16 if %inside%%outside% EQU TF (set crtsta=Inside & set tgtsta=Outside & set tgtip=172.16.35.%ipld%)
    17 if %inside%%outside% EQU FT (set crtsta=Outside & set tgtsta=Inside & set tgtip=192.168.208.%ipld%)
    18 if %inside%%outside% EQU FF (set crtsta=UnKnow & set tgtsta=Inside & set tgtip=192.168.208.%ipld%)
    19 
    20 echo Current Status: %crtsta%
    21 echo Target Status: %tgtsta%
    22 echo Target IP: %tgtip%
    23 echo Running...
    24 
    25 set /p = "Reboot network adapter..." < nul
    26 set S=F&set S2=F
    27 netsh interface set interface 本地连接 disabled >nul 2>nul && set S=T
    28 netsh interface set interface 本地连接 enable >nul 2>nul && set S2=T
    29 if %S%%S2% EQU TT (echo Succeed) else (echo Failed)
    30 
    31 set /p = "Set DHCP..." < nul
    32 set S=F&set S2=F
    33 netsh interface ip set address name="本地连接" source=static 192.168.1.1 255.255.255.0 192.168.1.1 >nul 2>nul && set S=T
    34 netsh interface ip set address name="本地连接" source=dhcp >nul 2>nul && set S2=T
    35 if %S%%S2% EQU TT (echo Succeed) else (echo Failed)
    36 
    37 set /p = "Set TargetIP..." < nul
    38 set S=F
    39 if %inside% EQU T netsh interface ip set address name="本地连接" source=static %tgtip% 255.255.255.0 172.16.35.254 1 >nul 2>nul && set S=T
    40 if %outside% EQU T netsh interface ip set address name="本地连接" source=static %tgtip% 255.255.255.0 192.168.208.254 1 >nul 2>nul && set S=T
    41 if %S% EQU F netsh interface ip set address name="本地连接" source=static %tgtip% 255.255.255.0 192.168.208.254 1 >nul 2>nul && set S=T
    42 if %S% EQU T (echo Succeed) else (echo Failed)
    43 
    44 set /p = "Set DNS Sever..." < nul
    45 set S=F&set S2=F
    46 netsh interface ip set dns "本地连接" static 114.114.114.114 primary >nul 2>nul && set S=T
    47 netsh interface ip add dns "本地连接" 114.114.115.115 >nul 2>nul && set S2=T
    48 if %S%%S2% EQU TT (echo Succeed) else (echo Failed)
    49 
    50 set /p = "Reboot network adapter again..." < nul
    51 set S=F&set S2=F
    52 netsh interface set interface 本地连接 disabled >nul 2>nul && set S=T
    53 netsh interface set interface 本地连接 enable >nul 2>nul && set S2=T
    54 if %S%%S2% EQU TT (echo Succeed) else (echo Failed)
    55 
    56 echo Checking...
    57 
    58 set S=F
    59 if %inside% EQU F (for /f "delims=" %%i in ('ipconfig ^| findstr /c:"192.168.208"') do (set S=T&& set wt=15))
    60 if %inside% EQU T (for /f "delims=" %%i in ('ipconfig ^| findstr /c:"172.16.35"') do (set S=T&& set wt=45))
    61 
    62 if "%S%" EQU "T" (ping 0 /n %wt% >nul 2>nul & color 0A & set str=Change Net Succeed! & title Succeed) else (color 0C & set str=Change Net Failed! & title Failed)
    63 
    64 echo. & echo %str% & pause > nul
    View Code
  • 相关阅读:
    弹框只弹一次(cookie)
    多个列表求笛卡尔积的几种方法
    mysqlrouter 8.0.17启动失败
    Eclipse启动项目成功,IDEA报错java.lang.ClassNotFoundException: javax.servlet.Filter
    java的回调机制,讲得很清楚
    Java 命令行 -D
    spring boot项目中,webservice生成客户端,wsdl可配置
    一个老项目的高并发改造,遇到的redis连接不释放问题。
    ExecuterService实现线程池
    子线程获取不到请求中变量的问题
  • 原文地址:https://www.cnblogs.com/gwsbhqt/p/5387838.html
Copyright © 2020-2023  润新知