How to set http proxy address for wget under windows?
If ran without parameters my wget
prints:
D:\>wget
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:/progra~1/wget/etc/wgetrc
D:\Apps\Util\wget: missing URL
Usage: D:\Apps\Util\wget [OPTION]... [URL]...
Try `D:\Apps\Util\wget --help' for more options.
This probably means, that is looks for file wgetrc
in c:/progra~1/wget/etc/wgetrc
. Unfortunately, this location is unavailable for non-root programs. I was thinking I can modify SYSTEM_WGETRC
or syswgetrc
environment variables, but this looks having no effect
D:\>echo %SYSTEM_WGETRC%
d:\apps\util\wgetrc
D:\>echo %syswgetrc%
D:\APPS\Util\wgetrc
wget --help
doesn't tell you much. For more detail you can check the online wget manual Or man wget (they are different things, it's often worth checking each)
In short, here's an example
C:\sdf>wget -e http_proxy=127.0.0.1:8118 www.google.com
and another
C:\sdf>set http_proxy=127.0.0.1:8118
C:\sdf>wget www.google.com
The manual mentions wgetrc
commands. You see some things about http proxies listed there.
6.3 Wgetrc Commands
http_proxy = string
Use string as http proxy, instead of the one specified in environment.https_proxy = string
Use string as https proxy, instead of the one specified in environment.8.1 Proxies
Wget supports proxies for both http and ftp retrievals. The standard way to specify proxy location, which Wget recognizes, is using the following environment variables:
http_proxy
https_proxy
If set, the http_proxy and https_proxy variables should contain the urls of the proxies for http and https connections respectively.
added
Regarding the wget man page and the "wget manual".
Man pages at the command line are up to date, but the manual(a different entity from manpage), is not always an up to date wget version. As of writing(sept 2015) it is. http://www.gnu.org/software/wget/manual/wget.html You can see the version at the top and check if it's the latest http://ftp.gnu.org/gnu/wget/ it shows dates too. (You see on archive.org that in e.g. Nov 2013 the gnu manual was very out of date. In Nov 2013 even March 2014, they were still showing wget 1.13.4 which was from 2011)
For the manpage, if you're checking from command line then it must be the version you're using so you can be fine there by just making sure your command is up to date / updating it. You may want to check that the/any online source you are using is showing the latest man page. This one seems fine https://www.kernel.org/doc/man-pages/ links to http://man7.org/linux/man-pages/man1/wget.1.html You can also check the version there against the ftp link to make sure it's the latest version.
I think you just want to set the HTTP_PROXY
environment variable.
From : http://www.gnu.org/software/wget/manual/html_node/Proxies.html:
Wget supports proxies for both http and ftp retrievals. The standard way to specify proxy location, which Wget recognizes, is using the following environment variables:
http_proxy
https_proxy
If set, the http_proxy and https_proxy variables should contain the urls of the proxies for http and https connections respectively.
barlop's answer in general is fine, but a few comments:
on the dos/windows command line or batch file, you specify
set http[s]_proxy=http[s]://proxyserver:port/
then wget works fine.
it will usually also take your windows single sign-on credentials if you are in a company network with NTLM authentication against the proxy (no need to hassle around with domain - backslash - user)