Sunday, September 20, 2020

Set proxy for command line in windows

 Ever wanted to force tools like curl and az cli to pass their traffic through a proxy while running them in cmd.exe?

Set the following environment variables and netsh will automatically pick up them and use them for all network connectivity.

Rem Based on https://stackoverflow.com/questions/26992886/set-proxy-through-windows-command-line-including-login-parameters
set HTTP_PROXY=http://proxy_userid:proxy_password@proxy_ip:proxy_port
set FTP_PROXY=%HTTP_PROXY%
set HTTPS_PROXY=%HTTP_PROXY%