素早くブラウザのプロキシを変える(Windows)
コマンドラインを使って、ブラウザのプロキシ、接続先のLANを素早く変更する方法を紹介します。(Windows)
コマンド実行するには、管理者権限が必要です。
事前準備
- Interface Nameの確認
$ netsh interface show interface
Admin State | State | Type | Interface Name |
---|---|---|---|
無効 | 切断 | 専用 | LanA ← 注目 |
有効 | 接続 | 専用 | LanB ← 注目 |
- Binaryデータの準備
仮想設定
-
LanA
- Proxy: 10.0.0.100:8800
- Ip Address: 10.0.0.10
- Mask: 255.255.0.0
- Gateway: 10.0.0.1
- DNS: 10.0.0.200
-
LanB
- Proxy: 172.0.0.100:9900
- Ip Address: 172.0.0.10
- Mask: 255.255.0.0
- Gateway: 172.0.0.1
- DNS: 172.0.0.200
LanAに切替
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyServer /t REG_SZ /d 10.0.0.100:8800
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v DefaultConnectionSettings /t REG_BINARY /d 4600000046000000030000001100000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v SavedLegacySettings /t REG_BINARY /d 4600000046000000030000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
netsh interface ip set address "LanA" static 10.0.0.10 255.255.0.0 10.0.0.1 1
netsh interface ip set dns "LanA" static 10.0.0.200
netsh interface set interface name="LanB" admin=DISABLED
netsh interface set interface name="LanA" admin=ENABLED
LanBに切替
reg add "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyServer /t REG_SZ /d 172.0.0.100:9900
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v DefaultConnectionSettings /t REG_BINARY /d 4600000046000000030000001100000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" /f /v SavedLegacySettings /t REG_BINARY /d 4600000046000000030000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
netsh interface ip set address "LanB" static 172.0.0.10 255.255.0.0 172.0.0.1 1
netsh interface ip set dns "LanB" static 172.0.0.200
netsh interface set interface name="LanA" admin=DISABLED
netsh interface set interface name="LanB" admin=ENABLED
Author And Source
この問題について(素早くブラウザのプロキシを変える(Windows)), 我々は、より多くの情報をここで見つけました https://qiita.com/wwalpha/items/78192ff4691e13d2739e著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .