从 windows 命令提示符中删除代理设置

Remove proxy settings from the windows command prompt

我在代理网络的时候在cmd中设置了代理设置如下:

set http_proxy=http://username:pass@hostname:port

set https_proxy=https://username:pass@hostname:port

既然我在正常网络上,我想在命令 prompt.Is 中取消设置代理设置,那里有任何直接命令可以让我取消设置 http_proxyhttps_proxy 环境变量直接用于命令行而不是通过 GUI 导航来删除它们?

尝试,

set http_proxy=
set https_proxy=
npm config delete proxy http

npm config delete proxy https

运行 CMD 或 Powershell 作为提升权限(运行 作为管理员)
然后运行命令 <strong>netsh winhttp 重置代理</strong>

P.S: 当您尝试使用 <strong>set http_proxy=http://username:pass@hostname:port</strong> 设置代理时,然后在退出期间命令提示符,代理可能会自动重置。

从提升的命令提示符(CMD 或 PS)键入:

netsh winhttp reset proxy

这应该产生:

C:\Windows\system32>netsh winhttp reset proxy Current WinHTTP proxy settings: Direct access (no proxy server).

此命令将重置您的代理设置,正如您在输出中看到的那样,它们将设置为 "no proxy server."

您也可以输入 netsh winhttp show proxy 来查看您当前的设置。

尝试以下步骤

  1. 以管理员身份打开 cmd 提示符
  2. 执行netsh winhttp 重置代理
  3. 执行 netsh winhttp show proxy - 您应该看到您当前的代理设置为 直接访问(无代理服务器)。
  4. 重新启动 PC - 在 运行 上述命令后我没有重新启动我的电脑,当我这样做时我仍然遇到代理问题 echo %HTTP_PROXY% , 重新启动会永久清除代理。
  5. 执行 echo %HTTP_PROXY% - 它应该 return 什么都没有。

如果有效请告诉我,干杯!

删除未来 cmd 实例的变量:

    setx http_proxy ""
    setx https_proxy ""

我已阅读 urllib.request.proxyhandler。

最简单的方法(由我自己测试和批准)是添加一个 no_proxy,例如:

SET no_proxy=abc.com,john.com:8080