【bat批处理文件语法】使用.bat批处理文件实现内外网多IP地址的切换

时间:2019-01-25  来源:php常用代码  阅读:

下面我们来看一篇关于使用.bat批处理文件实现内外网多IP地址的切换实例地希望本文章对大家会有所帮助。

 代码如下 复制代码

:: 使用.bat批处理文件实现内外网多IP地址的切换演示文件:IPchange.bat
    :: 还可以增加3,4,5等多个IP地址,只要增加相应的if语句和label跳转标签即可
    :: 首选DNS为谷歌的8.8.8.8,备用DNS为8.8.4.4
    @Echo Off
    TITLE IP设置
    :start
    cls
    color 3f
    :: 使用COLOR命令对控制台输出颜色进行更改
    mode con cols=56 lines=20
    :: MODE语句为设定窗体的宽和高
    :sc_main
    echo -------------------------------------------
    echo.&echo.
    echo 0.192.168.154.29 & echo.
    echo 1.132.114.154.29 & echo.
    echo q.退出 & echo.&echo.&echo.&echo.&echo.&echo.
    set "select="
    set /p select= 输入数字,按回车继续 :
    if "%select%"=="0" (goto sc_ip0)
    if "%select%"=="1" (goto sc_ip1)
    if "%select%"=="Q" (goto sc_exit)
    :sc_exit
    exit
    goto :eof
    :sc_ip0
    cls
    echo 正在设置中,请稍候
    Netsh interface IP Set Address "本地连接" Static 192.168.154.29 255.255.255.0 192.168.154.250 1
    netsh interface ip set dns "本地连接" static 8.8.8.8
    netsh interface ip add dns "本地连接" 8.8.4.4
    echo 成功设置外网192.168.154.29
    PAUSE >nul
    Goto sc_main
    :sc_ip1
    cls
    echo 正在设置中,请稍候
    netsh interface IP Set Address "本地连接" Static 132.114.154.29 255.255.255.0 132.114.154.250 1
    netsh interface ip set dns "本地连接" static 8.8.8.8
    netsh interface ip add dns "本地连接" 8.8.4.4
    echo 成功设置内网 132.114.154.29
    PAUSE >nul
    Goto sc_main

【bat批处理文件语法】使用.bat批处理文件实现内外网多IP地址的切换

http://m.bbyears.com/jiaocheng/47519.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新