win8(win7)批处理设置IP

@rem 根据自己的需要修改带 (@rem/注释)的地方,修改完毕后直接将本文件后缀名.txt改为.bat即可使用
@rem 运行 : 右键菜单-〉以管理员身份运行
@echo off
title --IP自动设置 --
MODE con: COLS=80 lines=30
color 0a
:menu
cls
echo ----------------------------------
echo      请选择,输入数字按回车
echo ----------------------------------
echo.
echo      设置为公司用IP 请按 1
echo      设置为自动获取 请按 2
echo      设置IE代理    请按 3
echo      清除IE代理    请按 4
echo      查看当前IP    请按 5
echo      退出          请按 6
echo.
set /p choice=      您的选择:
echo.
if "%choice%"=="1" goto ip1
if "%choice%"=="2" goto ip2
if "%choice%"=="3" goto ie3
if "%choice%"=="4" goto ie4
if "%choice%"=="5" goto ip5
if "%choice%"=="6" goto end
goto menu
:ip1
echo 公司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.3
netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0
netsh interface ip add address "%INTERFACE%" %IP2% %MASK2% %GATEWAY2% 0
netsh interface ip set dns "%INTERFACE%" static %DNS1% PRIMARY
netsh interface ip add dns "%INTERFACE%" %DNS2% index=2
@echo 设置完毕,自动退出!
exit
:ip2
echo IP自动设置开始....
echo.
echo 自动获取IP地址....
@rem  win7: name="本地连接"  win8: name = "以太网"
netsh interface ip set address name = "以太网" source = dhcp
echo 自动获取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 off
cls
color 0A
ipconfig /all
pause >nul
goto menu

本文发布于:2024-09-21 22:57:09,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/1/474063.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:IP67防水等级
下一篇:ISO 20653.
标签:设置   自动   完毕   代理   退出   运行
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议