zoukankan      html  css  js  c++  java
  • 自动设置网络IP地址


    社会在不断的发展,网络也在断的完善,迫使我们需要在不同的网络环境下,设置不同IP,不仅麻烦而且难记。为图个方便,写了个批处理文件,可在家里,办公室等不同环境下,自动修改IP。

    四个选项,默认 2[Offoce2][等待10秒]

    F:family:家里动态IP设置
    2:Office2:办公室网关2 IP设置
    5:Office5:办公室网关5 IP设置
    P:Pantry:其他工作点IP设置

    如有不详,请留言。

    -----------------------------------------------------------------------------------
    文件名:IPChange.bat

    @echo off
    choice /c f52p /m Family,Office5,Office2,Pantry /D 2 /T 10

    if errorlevel 4 goto pantry
    if errorlevel 3 goto office2
    if errorlevel 2 goto office5
    if errorlevel 1 goto family

    :family
    echo Set family Start......
    netsh interface ip reset log.txt
    netsh interface ip set address name=本地连接 source=dhcp
    netsh interface ip set address name=本地连接 gateway=none
    netsh interface set interface 本地连接 disable
    netsh interface set interface 本地连接 enable
    del log.txt
    echo Set family End.
    goto end

    :office5
    echo Set office5 start......
    netsh interface ip reset log.txt
    netsh interface ip set address name=本地连接 source=static addr=192.168.22.111 mask=255.255.255.0
    netsh interface ip set address name=本地连接 gateway=192.168.22.5 gwmetric=0
    netsh interface ip set dns name=本地连接 source=static addr=202.101.103.55 register=PRIMARY
    del log.txt
    echo Set office5 End.
    goto end

    :office2
    echo Set office2 Start......
    netsh interface ip reset log.txt
    netsh interface ip set address name=本地连接 source=static addr=192.168.22.111 mask=255.255.255.0
    netsh interface ip set address name=本地连接 gateway=192.168.22.2 gwmetric=0
    netsh interface ip set dns name=本地连接 source=static addr=202.101.103.55 register=PRIMARY
    del log.txt
    echo Set office2 End.
    goto end

    :pantry
    echo Set pantry Start......
    netsh interface ip reset log.txt
    netsh interface ip set address name=本地连接 source=static addr=192.168.1.199 mask=255.255.255.0
    netsh interface ip set address name=本地连接 gateway=192.168.1.254 gwmetric=0
    netsh interface ip set dns name=本地连接 source=static addr=202.101.103.55 register=PRIMARY
    del log.txt
    echo Set pantry End.
    goto end

    :end
    echo Good Lock
    @echo on


     

    原码:IPChange.bat 下载

  • 相关阅读:
    程序员父亲的遗产——编程十诫 转载
    如何跟程序员谈一场没有Bug的恋爱
    java集合(ArrayList,Vector,LinkedList,HashSet,TreeSet的功能详解)
    CentOS7.0下载各版本说明 新增Everything版
    Virtualbox虚拟机安装CentOS 6.5图文详细教程
    s:iterator数据累加示例代码
    关于程序员的59条搞笑但却真实无比的编程语录
    jQuery EasyUI API 中文文档
    Java发送带html标签内容的邮件
    javascript比较两个时间大小
  • 原文地址:https://www.cnblogs.com/LeeWenjie/p/570775.html
Copyright © 2011-2022 走看看