`

换IP脚本工具,献给网络环境超复杂的码农同胞

阅读更多

对于经常穿梭于不同地点,置身于复杂网络环境的选手来说,换IP是个头疼的事情,比如像我之前那段时间,写代码常驻地是电信宽带,有线无线,没准哪个会有故障,回到处住,用的电信,仍然是有线无线均可选择,回到公司,联通宽带,有线有时绑定IP,MAC,还会绑定端口,无线网络又经常极差,有时,还会需要使用goagent爬墙,还有时你可能不想有线无线同时启用。。。网段各种诡异各种奇葩,DNS各种记不住,好在,有了这段脚本,让换IP变成一种享受~~,哈哈,将下面代码,精简或是修改成你需要的部分,保存为ip.bat放在桌面,事情就变得简单多了~

@echo off

@rem 设置需要使用的代理服务器地址===========================================
 set ProxyServerValue=127.0.0.1:8087
@rem 无需使用代理服务器的地址,注意:",<local>"表示激活无需使用的地址,一定要保留
 set ProxyOverrideValue="10.*,<local>" 


@rem ==============================================================================
:menu
 cls
 echo.
 echo                        IP设置脚本(不区分大小写)
 echo               ==================================
 echo                        1:    无线自动
 echo                        2:    无线公安
 echo                        3:    有线自动
 echo                        4:    有线宿舍
 echo                        5:    有线公安
 echo                        6:    有线晓山
 echo                        7:    无线宿舍
 echo                        8:    无线晓山
 echo               ==================================
 echo                        P:    设置代理
 echo                        N:    取消代理
 echo                       EB:    启用本地连接 
 echo                       DB:    禁用本地连接
 echo                       EW:    启用无线连接
 echo                       DW:    禁用无线连接
 echo                        Q:    退出
 echo.

@echo off
set /p input=选择上网地点并回车:

if "%input%"=="1" goto IP_1
if "%input%"=="2" goto IP_2
if "%input%"=="3" goto IP_3
if "%input%"=="4" goto IP_4
if "%input%"=="5" goto IP_5
if "%input%"=="6" goto IP_6
if "%input%"=="7" goto IP_1
if "%input%"=="8" goto IP_1
if "%input%"=="p" goto IP_P
if "%input%"=="P" goto IP_P
if "%input%"=="n" goto IP_N
if "%input%"=="N" goto IP_N
if "%input%"=="eb" goto IP_EB
if "%input%"=="EB" goto IP_EB
if "%input%"=="db" goto IP_DB
if "%input%"=="DB" goto IP_DB
if "%input%"=="ew" goto IP_EW
if "%input%"=="EW" goto IP_EW
if "%input%"=="dw" goto IP_DW
if "%input%"=="DW" goto IP_DW
if "%input%"=="Q" exit
if "%input%"=="q" exit


:IP_1
netsh interface ip set address "无线网络连接" dhcp
netsh interface ip set dnsservers "无线网络连接" dhcp
goto end

:IP_2
netsh interface ip set address "无线网络连接" static 192.168.170.221 255.255.255.0 192.168.170.1
netsh interface ip set dnsservers "无线网络连接" static 221.228.255.1 primary yes
goto end

:IP_3
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dnsservers "本地连接" dhcp

goto end

:IP_4
netsh interface ip set address "本地连接" static 192.168.1.106 255.255.255.0 192.168.1.1
netsh interface ip set dnsservers "本地连接" static 221.228.255.1 primary yes

goto end

:IP_5
netsh interface ip set address "本地连接" static 192.168.168.221 255.255.255.0 192.168.168.1
netsh interface ip set dnsservers "本地连接" static 221.228.255.1 primary yes
goto end

:IP_6
netsh interface ip set address "本地连接" static 192.168.1.85 255.255.255.0 192.168.1.254
netsh interface ip set dnsservers "本地连接" static 221.6.4.66 primary yes
goto end



@rem ==============================================================================
:IP_P
 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
goto end
@rem ==============================================================================
:IP_N
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t reg_dword /d 00000000 /f
goto end

:IP_EB
netsh interface set interface name="本地连接" admin=ENABLED
goto end

:IP_DB
netsh interface set interface name="本地连接" admin=DISABLED
goto end

:IP_EW
netsh interface set interface name="无线网络连接" admin=ENABLED
goto end

:IP_DW
netsh interface set interface name="无线网络连接" admin=DISABLED
goto end

:end
goto menu

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics