加载中…
个人资料
善用佳软
善用佳软 新浪个人认证
  • 博客等级:
  • 博客积分:0
  • 博客访问:31,171
  • 关注人气:3,357
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

DIY:非常实用的原创小工具-EasyIP

(2007-03-20 21:13:53)
分类: 系统工具
  接上文非常实用的原创小工具:EasyIP。自己用批处理,最大的两个优点是小巧、灵活。但如果发出来供大家用,就要考虑N种情况,就会体积变大而且复杂起来。即,EasyIP是一个模板,大家可以启发而改造。下面附上我在用的版本,仅1KB,可实现切换IP,设定IE代理,测试网络功能。
------代码开始------>

:: 原程序为EasyIP v1.3,作者Lile。xbeta修改后自用
@echo off 
    set ProxyServerValue=10.68.200.233:8080
    set ProxyOverrideValue="10.*,<local>"  
    set NetConf="local"
    set TestIP="10.68.68.254"

    if "%1%"=="bj" goto bj
    if "%1%"=="0" goto dhcp
    if "%1%"=="p" goto proxy
    if "%1%"=="n" goto noproxy
    if "%1%"=="t" goto test
    echo 命令有误,按任意退出。
    pause >nul
    exit

:bj
    set MyIP=10.68.68.85
    set MyGateWay=10.68.68.254
    set MyMask=255.255.255.0       
    set DNS1=10.68.100.211
    set DNS2=10.68.100.212
    goto setip

:dhcp
    netsh interface ip set address "%NetConf%" dhcp
    netsh interface ip set dns "%NetConf%" dhcp
    exit

:setip
    netsh interface ip set address name="%NetConf%" source=static addr=%MyIP% mask=%MyMask%
    netsh interface ip set address name="%NetConf%" gateway=%MyGateWay% gwmetric=0
    netsh interface ip set dns name="%NetConf%" source=static addr=%DNS1% register=PRIMARY
    netsh interface ip add dns name="%NetConf%" addr=%DNS2%
    netsh interface ip set wins name="%NetConf%" source=static addr=none
    exit
   
:proxy
    reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t reg_sz /d %ProxyServerValue% /f
    reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t reg_sz /d %ProxyOverrideValue% /f
    reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t reg_dword /d 00000001 /f
    exit

:noproxy
    reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t reg_dword /d 00000000 /f
    exit

:test
    ping %TestIP%
    pause
    exit

<------代码结束------

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有