Quickly Set PowerShell HTTP Proxy

This is a guide on how to quickly set up and tear down an HTTP proxy in PowerShell. Here are the steps:

  1. Allow PowerShell to run scripts. Open PowerShell with administrator privileges and enter the command:
set-ExecutionPolicy RemoteSigned
  1. Modify the PowerShell Profile file with the command:
code $profile
  1. 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=""}
  1. Now, you can use pxy_on to turn on the proxy and pxy_off to turn off the proxy.