Last active
July 24, 2024 17:04
-
-
Save famousgarkin/c5138b1e13ac41920d22 to your computer and use it in GitHub Desktop.
PowerShell Set-Proxy, Clear-proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: registry keys for IE 8, may vary for other versions | |
$regPath = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' | |
function Clear-Proxy | |
{ | |
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 0 | |
Set-ItemProperty -Path $regPath -Name ProxyServer -Value '' | |
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value '' | |
[Environment]::SetEnvironmentVariable('http_proxy', $null, 'User') | |
[Environment]::SetEnvironmentVariable('https_proxy', $null, 'User') | |
} | |
function Set-Proxy | |
{ | |
$proxy = 'http://example.com' | |
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 1 | |
Set-ItemProperty -Path $regPath -Name ProxyServer -Value $proxy | |
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value '<local>' | |
[Environment]::SetEnvironmentVariable('http_proxy', $proxy, 'User') | |
[Environment]::SetEnvironmentVariable('https_proxy', $proxy, 'User') | |
} |
How do I execute this code?
我试过了powershell只能使用http代理,不能使用socks5代理.
大佬,有powershell配置socks5的方法吗
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do I execute this code?