3

Is there a command that can replace the manual way of setting the system proxy:

PC setting -> Network-> Proxy -> Manual Proxy Setup

I found other answers mention using netsh winhttp set proxy myproxy but I have found that does not always work.

2

1 Answer 1

8

That depends on the applications you are using. For some it is enough to set the following environment variable :

set HTTP_PROXY=http://proxy_userid:proxy_password@proxy_ip:proxy_port

And if necessary :

set FTP_PROXY=%HTTP_PROXY%
set HTTPS_PROXY=%HTTP_PROXY%

For others, especially browsers, the following may do the job :

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d name:port
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyUser /t REG_SZ /d username
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyPass /t REG_SZ /d password
netsh winhttp import proxy source=ie

You may add to the reg commands the parameter /f to overwrite existing entries without asking.

To undo, disable the proxy by setting ProxyEnable to 0.

And for still others this is a setting to be set in the program itself.

Not the answer you're looking for? Browse other questions tagged .