命令行走代理,http_proxy和https_proxy设置问题

windows中命令行要使用代理,http_proxy和https_proxy有如下写法:

1、有引号

set http_proxy="socks5://127.0.0.1:13569"   
set https_proxy="socks5://127.0.0.1:13569" 

2、无引号

set http_proxy=socks5://127.0.0.1:13569
set https_proxy=socks5://127.0.0.1:13569

问题:
1、加上引号使用会报错:

D:\vagrant_env
λ set http_proxy="socks5://127.0.0.1:13569"

D:\vagrant_env
λ set https_proxy="socks5://127.0.0.1:13569"

D:\vagrant_env
λ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): http://"socks5://127.0.0.1:13569" (URI::InvalidURIError)

2、不加引号好像同样翻不了:

D:\vagrant_env
λ set http_proxy=socks5://127.0.0.1:13569

D:\vagrant_env
λ set https_proxy=socks5://127.0.0.1:13569

D:\vagrant_env
λ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:

  no such name (https://gems.hashicorp.com/specs.4.8.gz)

Source: https://gems.hashicorp.com/

所以,应该怎么写才对?

阅读 39.9k
1 个回答

因为 socks5://127.0.0.1:13569 这是 socks5 代理, 不是 http 代理.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进