This is a guide on how to quickly set up and tear down an HTTP proxy in PowerShell. Here are the steps:
- Allow PowerShell to run scripts. Open PowerShell with administrator privileges and enter the command:
set-ExecutionPolicy RemoteSigned
- Modify the PowerShell Profile file with the command:
code $profile
- Add the following functions to the profile:
function pxy_on {$Env:http_proxy="http://127.0.0.1:7890";$Env:https_proxy="http://127.0.0.1:7890"}
function pxy_off {$Env:http_proxy="";$Env:https_proxy=""}
- Now, you can use
pxy_on
to turn on the proxy andpxy_off
to turn off the proxy.