How to set proxy from command line Windows 7
Asked Answered
C

2

5

I need to set a proxy using command line in windows .

Have you any idea about the commands to execute ?

Thank you in advance .

Codger answered 12/4, 2016 at 11:25 Comment(0)
J
9

For me neither the above in the previous answer neither what suggested here(that is quite the same, only explained a bit better).

What instead has worked so far, and only for the session, is this command:

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

as from really well explained here

Then I was able to retrieve web content as for example:

Invoke-WebRequest http://example.org
Jackstay answered 27/7, 2017 at 11:26 Comment(2)
how do you run this for each new powershell instance??Smoothshaven
@gianni, what you mean exactly? At same time? I guess you can write a powershell script in the integrated env, as I guess still exist. Is been a while since I don't use powershell now.Jackstay
C
4

I believe it is a possible duplicate of https://superuser.com/questions/419696/in-windows-7-how-to-change-proxy-settings-from-command-line

There is a command named set proxy. See the following:

set HTTP_PROXY=http://user:[email protected]:port

Using netsh

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

Also see the following:

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

Congelation answered 12/4, 2016 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.