2012-05-02 16:08:50 +0000 2012-05-02 16:08:50 +0000
46
46
Advertisement

Windows7で、プロキシの設定をコマンドラインから変更するには?

Advertisement

Windows 7で、プロキシの設定をコマンドラインから変更するには?

http_proxyだけの話ではありません。システム全体のプロキシ設定(インターネットのプロパティ設定にあるもの)が必要なんです。どうすればいいのでしょうか?

Advertisement
Advertisement

回答 (5)

62
62
62
2012-08-29 10:57:56 +0000

Simple and working solution retrieved from http://www.ehow.com/how_6887864do-proxy-settings-command-prompt_.html

Command to enable proxy usage:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^
    /v ProxyEnable /t REG_DWORD /d 1 /f

Command to disable proxy usage:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^
    /v ProxyEnable /t REG_DWORD /d 0 /f

Command to change the proxy address:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^
    /v ProxyServer /t REG_SZ /d proxyserveraddress:proxyport /f

002 読みやすさのために行の続き(^)を追加しました。また、今回の場合はシステム全体の設定というよりも、ユーザーごとの設定という感じです。

27
27
27
2012-05-02 19:56:20 +0000

NetSh ] (http://technet.microsoft.com/en-us/library/cc731131%28WS.10%29.aspx#BKMK_5) でレスキュー!

NetSh winhttp set proxy が役に立つはずです。以下のコマンドを実行してみましょう:

netsh winhttp set proxy myproxy

netsh winhttp set proxy myproxy:80 "<local>bar"

netsh winhttp set proxy proxy-server="http=myproxy;https=sproxy:88" bypass-list="*.contoso.com"

4
Advertisement
4
4
2015-12-05 10:02:58 +0000
Advertisement

C#でやってみましたが、フィロソフィーはレジストリへの書き込みと同じなので、以下のような命令をラインコマンドに外挿します。それは、3つのことをしなければならない:

  1. レジストリ「HKCUSoftware\MicrosoftWIndows\CurrentVersion\Internet Settings」にProxyEnableで書き込みます。1 to enable, 0 to disable

  2. 2.Write to Registry “HKCUUSoftware\MicrosoftWoods\CurrentVersion\Internet Settings” on ProxyServer: xxx.xxx.xxx.xxx.xxx.xxxx:yyyy (xxx…はIP、yy…はポート)

  3. 手順1と2を実行した後、レジストリにプロキシの有効化とIPとポートを書き込んだはずですが、ブラウザを開くと、それだけでは不十分で、まだナビゲートできないことに気づくでしょう。3つ目のステップは、接続設定に関するレジストリを変更することです。バイト8の値はプロキシの有効/無効に関する情報だけでなく、他の機能に関する情報も含んでいます:

//09 when only 'Automatically detect settings' is enabled 
        //03 when only 'Use a proxy server for your LAN' is enabled
        //0B when both are enabled
        //05 when only 'Use automatic configuration script' is enabled
        //0D when 'Automatically detect settings' and 'Use automatic configuration script' are enabled
        //07 when 'Use a proxy server for your LAN' and 'Use automatic configuration script' are enabled
        //0F when all the three are enabled. 
        //01 when none of them are enabled.

私の場合、「設定の自動検出」は常に有効になっているので、バイト8の値を09から0Bに切り替えて、プロキシを有効/無効にしています。

2
2
2
2012-09-14 13:27:28 +0000

バッチファイルを作成し、以下の内容を貼り付けてください(プロキシの状態を切り替えます)、

@echo off

FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable') DO SET currentProxy=%%B
rem ECHO currentProxy=%currentProxy%

if %currentProxy%==0x1 (
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
echo Proxy Disabled
) else (
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
echo Proxy Enabled
  )

pause
-3
Advertisement
-3
-3
2012-05-02 16:18:31 +0000
Advertisement

私はここで正しい方向を示していることを願っていますが、もしあなたが “インターネットオプション "からプロキシ設定にアクセスしようとしているならば、単にスタートメニューを開き、"インターネットオプション "と入力してください(この方法で見つけることができる任意の設定やアプリケーションは、例として "プロキシ "も)。このメニューを認識して、必要な設定を追加することができるはずです。

Advertisement

関連する質問

3
19
10
28
1
Advertisement
Advertisement