Windows下的命令提示符(Command/cmd)默认和浏览器不一样,如果你设置了走代理的软件,默认在命令行下运行的程序也是不走代理的,需要在命令行上执行如下命令:
set HTTP_PROXY=http://127.0.0.1:10809 set HTTPS_PROXY=http://127.0.0.1:10809 rem 如果设置了用户名和密码,那么 set HTTP_PROXY=http://192.168.1.2:10809 set HTTP_PROXY_USER=username set HTTP_PROXY_PASS=password set HTTPS_PROXY=http://192.168.1.2:10809 set HTTPS_PROXY_USER=username set HTTPS_PROXY_PASS=password rem 或者这样: set HTTP_PROXY=http://username:[email protected]:10809 set HTTPS_PROXY=http://username:[email protected]:10809
以上都是针对当前命令行生效的,关闭后再次打开就恢复原状了
如果是PowerShell,使用如下命令:
$env:http_proxy="http://127.0.0.1:1080" $env:https_proxy="http://127.0.0.1:1080"
MacOS/Linux下如何设置,详见:https://blog.terrynow.com/2021/11/22/macos-linux-terminal-run-command-via-proxy-howto/
文章评论