教程集 www.jiaochengji.com
教程集 >  操作系统  >  windows  >  正文 使用.bat批处理文件实现内外网多IP地址的切换

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

发布时间:2020-03-31   编辑:jiaochengji.com
教程集为您提供使用.bat批处理文件实现内外网多IP地址的切换等资源,欢迎您收藏本站,我们将为您提供最新的使用.bat批处理文件实现内外网多IP地址的切换资源
下面我们来看一篇关于使用.bat批处理文件实现内外网多IP地址的切换实例地希望本文章对大家会有所帮助。
<script>ec(2);</script>
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy7672')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy7672>

:: 使用.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

</td> </tr> </table></td> </tr> </table>

您可能感兴趣的文章:
使用.bat批处理文件实现内外网多IP地址的切换
批处理显示局域网中的当前IP地址
使用ARP排除网络故障
windows常用网络命令批处理脚本
使用批处理修改本机HOST的方法
什么是批处理
用批处理分配IP和修改dns
ARP实现本机绑定的bat代码
Arp命令详解
什么是MAC地址-基础知识

[关闭]
~ ~