【问题标题】:How to set proxy from command line Windows 7如何从命令行 Windows 7 设置代理
【发布时间】:2016-04-12 11:25:30
【问题描述】:

我需要在 windows 中使用命令行设置代理。

你知道要执行的命令吗?

提前谢谢你。

【问题讨论】:

    标签: powershell command-line proxy windows-7-x64


    【解决方案1】:

    对我来说,上一个答案中的上述内容和here的建议都不是(这完全一样,只是解释得更好一点)。

    到目前为止,只有在会话中起作用的是这个命令:

    (New-Object System.Net.WebClient).Proxy.Credentials =  
    [System.Net.CredentialCache]::DefaultNetworkCredentials
    

    从很好的解释here

    然后我能够检索网页内容,例如:

    Invoke-WebRequest http://example.org
    

    【讨论】:

      【解决方案2】:

      我认为它可能与https://superuser.com/questions/419696/in-windows-7-how-to-change-proxy-settings-from-command-line 重复

      有一个名为 set proxy 的命令。请参阅以下内容:

      set HTTP_PROXY=http://user:password@proxy.domain.com:port
      

      使用 netsh

      netsh winhttp set proxy  [proxy server address:port number] [bypass list]
      

      另请参阅以下内容:

      http://www.ehow.com/how_6887864_do-proxy-settings-command-prompt_.html

      https://superuser.com/questions/337685/how-do-i-change-the-windows7-lan-proxy-config-from-the-command-line

      【讨论】:

        猜你喜欢
        • 2014-08-30
        • 2017-01-29
        • 2020-01-16
        • 2012-08-30
        • 1970-01-01
        • 2013-05-14
        • 2013-11-29
        • 2019-02-02
        • 2010-10-25
        相关资源
        最近更新 更多