I am trying to set up a daily scheduled download of files from an external web-server, using WGET
, Windows' task-scheduler and command-scripts.
Since WGET
will be run on a server from within the company's internal network, it has to first connect through our HTTP-proxy server, which requires proxy-authentication (HTTP 407), and then when the external web-server is reached, it too also requires authentication (HTTP 401), before the files can be downloaded.
Now this all works, using the following command-line, which unfortunatly contains visible passwords in the command-script:
wget.exe -e http_proxy=http://company-proxy:80
--proxy-user=PROXYUSER --proxy-password=PROXYPASSWORD
--http-user=HTTPUSER --http-password=HTTPPASSWORD
"http://www.example.com/folder/FileToDownload.txt"
Since the scheduled-task, that is starting WGET
(or command-script), has to run as PROXYUSER
with PROXYPASSWORD
, I was wondering if it is possible to somehow read or give these values to the --proxy..
arguments of WGET
, and not having them in plain sight within the command-line/-script?
E.g.
wget.exe --proxy-user=<Get_User_From_ScheduledTask>
--proxy-password=<Get_Password_From_ScheduledTask>
...
Or alternatively, from a Windows command-script, is there a way to "programmatically read" values (stored in some kind of registry-database or "vault"), that only the run as user will have access to?
i think wgetrc will solve your problem.
look here and here.