Windows 7에서는 명령줄에서 프록시 설정을 변경하는 방법은 무엇입니까?

Windows 7에서는 명령줄에서 프록시 설정을 변경하는 방법은 무엇입니까?

Windows 7의 명령줄에서 프록시 설정을 어떻게 변경합니까?

나는 단지 http_proxy. 시스템 전체 프록시 설정(인터넷 속성 설정의 설정)을 지정해야 합니다. 어떻게 해야 하나요?

답변1

일반적으로 제어판을 통해 변경하는 레지스트리 스크립트를 구성한 다음 스크립트를 병합하여 프록시를 활성화해야 합니다. 변경 사항을 비활성화하려면 "실행 취소" 레지스트리 스크립트도 필요합니다.

내 경우에는 활성화.reg와 비활성화.reg라는 두 개의 스크립트가 있습니다.

프록시 활성화:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"AutoConfigURL"="http://10.10.10.1/autoproxy/proxy.pac"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
"DefaultConnectionSettings"=hex:16,00,00,00,05,02,00,00,0d,00,00,00,0e,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"SavedLegacySettings"=hex:36,00,00,00,46,1a,00,00,0d,00,00,00,0e,00,00,00,32,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

프록시 비활성화:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"AutoConfigURL"=-

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
"DefaultConnectionSettings"=hex:16,00,00,00,05,02,00,00,0d,00,00,00,0e,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"SavedLegacySettings"=hex:36,00,00,00,46,1a,00,00,0d,00,00,00,0e,00,00,00,32,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

"비활성화" 스크립트에서 =-AutoConfigURL 끝 부분은 실제로 레지스트리에서 키를 삭제합니다.

위에 표시된 값은 이 답변의 목적에 따라 수정되었습니다. 실제 16진수 값은 훨씬 더 깁니다.

이 스크립트를 사용하기 위해 각 스크립트에 대해 다음과 같은 배치 파일이 있었습니다.

@echo off
start /min reg import C:\Path\To\Registry\File\enable_proxy.reg

이는 명령줄에서 완전히 실행 가능합니다.

답변2

간단하고 작동하는 솔루션은 다음에서 검색되었습니다.http://www.ehow.com/how_6887864_do-proxy-settings-command-prompt_.html

프록시 사용을 활성화하는 명령:

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 ProxyEnable /t REG_DWORD /d 0 /f

프록시 주소를 변경하는 명령:

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

가독성을 높이기 위해 줄 연속(^)을 추가했습니다. 또한 이 경우 시스템 전체 설정이라기보다는 사용자별 설정에 가깝습니다.

답변3

NetSh구조하러!

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

배치 파일을 생성하고 다음 내용을 붙여넣습니다(프록시 상태가 전환됩니다).

@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

관련 정보