Skip to content

Instantly share code, notes, and snippets.

@kleo
Forked from parzonka/call-wget-example.bat
Last active August 10, 2017 01:31
Show Gist options
  • Save kleo/cb0217677deebd43b23dfccf41a96917 to your computer and use it in GitHub Desktop.
Save kleo/cb0217677deebd43b23dfccf41a96917 to your computer and use it in GitHub Desktop.
wget for windows cmd (credits: https://superuser.com/a/536400/)
cscript /nologo wget.js http://example.com
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
WScript.Echo(WinHttpReq.ResponseText);
/* To save a binary file use this code instead of previous line
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile("out.bin");
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment