win 8(win 7)批处理设置IP

来源:互联网 发布:数据线上带充电宝 编辑:程序博客网 时间:2024/06/08 13:35

适合所有经常更改IP的朋友,里面的内容可用可用根据自己的需要随意修改


@rem 根据自己的需要修改带 (@rem/注释)的地方,修改完毕后直接将本文件后缀名.txt改为.bat即可使用@rem 运行 : 右键菜单-〉以管理员身份运行@echo offtitle --IP自动设置 -- MODE con: COLS=80 lines=30color 0a:menuclsecho ----------------------------------echo       请选择,输入数字按回车echo ----------------------------------echo.echo       设置为公司用IP 请按 1echo       设置为自动获取 请按 2echo       设置IE代理     请按 3echo       清除IE代理     请按 4echo       查看当前IP     请按 5echo       退出           请按 6echo.set /p choice=      您的选择:echo.if "%choice%"=="1" goto ip1if "%choice%"=="2" goto ip2if "%choice%"=="3" goto ie3if "%choice%"=="4" goto ie4if "%choice%"=="5" goto ip5if "%choice%"=="6" goto endgoto menu:ip1echo 公司IP自动设置开始....@rem  win7:INTERFACE=本地连接   win8:INTERFACE=以太网@set INTERFACE=以太网@rem  以下地址是无效的,请根据自己实际IP而更改@set IP=192.168.144.101@set MASK=255.255.255.0@set GATEWAY=192.168.144.131@set IP2=172.28.88.131@set MASK2=255.255.255.0@set GATEWAY2=192.168.144.254@set DNS1=192.168.181.10@set DNS2=192.168.12.3netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0netsh interface ip add address "%INTERFACE%" %IP2% %MASK2% %GATEWAY2% 0netsh interface ip set dns "%INTERFACE%" static %DNS1% PRIMARYnetsh interface ip add dns "%INTERFACE%" %DNS2% index=2@echo 设置完毕,自动退出!exit:ip2echo IP自动设置开始....echo.echo 自动获取IP地址....@rem  win7: name="本地连接"   win8: name = "以太网"netsh interface ip set address name = "以太网" source = dhcpecho 自动获取DNS服务器....netsh interface ip set dns name = "以太网" source = dhcp @echo 设置完毕,自动退出!exit:ie3@echo off echo 开始设置IE代理上网 @rem 172.88.28.10:80 修改为自己要设置的代理以及端口reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "172.88.28.10:80" /f  @echo 设置代理完毕,自动退出!exit:ie4@echo off echo 开始清除IE代理设置 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f echo IE代理清除完毕,自动退出! exit:ip5@echo offclscolor 0Aipconfig /allpause >nulgoto menu  


原创粉丝点击