[英]Remove proxy settings from the windows command prompt
I had set proxy settings in cmd when I was in a proxy network as follows:当我在代理网络中时,我在 cmd 中设置了代理设置,如下所示:
set http_proxy=http://username:pass@hostname:port
set https_proxy=https://username:pass@hostname:port
Now that I am on a normal network I want to unset the proxy settings in the command prompt.Is there any direct command that would let me unset the http_proxy
and https_proxy
environment variables directly for the command line rather that navigating through the GUI to delete them?现在我在普通网络上,我想在命令提示符中取消设置代理设置。是否有任何直接命令可以让我直接为命令行取消设置
http_proxy
和https_proxy
环境变量,而不是通过 GUI 导航来删除它们?
try,尝试,
set http_proxy=
set https_proxy=
From an elevated command prompt (CMD or PS) type:从提升的命令提示符(CMD 或 PS)键入:
netsh winhttp reset proxy
This should produce:这应该产生:
C:\\Windows\\system32>netsh winhttp reset proxy Current WinHTTP proxy settings: Direct access (no proxy server).
This command will reset your proxy settings and as you can see by the output, they will be set to "no proxy server."此命令将重置您的代理设置,正如您在输出中看到的那样,它们将设置为“无代理服务器”。
You can also type netsh winhttp show proxy
to see what your current settings are.您还可以键入
netsh winhttp show proxy
以查看您当前的设置。
npm config delete proxy http
npm config delete proxy https
When you try to set proxy using set http_proxy=http://username:pass@hostname:port
then during the exit of the command prompt, the proxy might get reset.当您尝试使用
set http_proxy=http://username:pass@hostname:port
设置代理时,在退出命令提示符期间,代理可能会重置。
But, Instead you can reset it via Command: netsh winhttp reset proxy
.但是,您可以通过命令重置它:
netsh winhttp reset proxy
。
Note: Run command Prompt as administrator注意:以管理员身份运行命令提示符
Try below steps尝试以下步骤
Let me know if it works, cheers!让我知道它是否有效,干杯!
To delete variables for future cmd instances:删除未来 cmd 实例的变量:
setx http_proxy ""
setx https_proxy ""
I've read the urllib.request.proxyhandler.我已经阅读了 urllib.request.proxyhandler。
The easiest way (test and approuved by myself) is to add an no_proxy such as this :最简单的方法(由我自己测试和批准)是添加一个 no_proxy ,例如:
SET no_proxy=abc.com,john.com:8080
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.