Skip to content

Instantly share code, notes, and snippets.

@bitnetwork bitnetwork/wget.js forked from udawtr/wget.vbs
Last active Mar 22, 2020

What would you like to do?
wget.js - similar to wget but written in jscript
//wget.js - similar to wget but written in vbscript
//based on a script by Chrissy LeMaire
//forked by Bit
var shell = new ActiveXObject("");
if (WScript.Arguments.length < 1) {
shell.Popup("Usage: wget.js <url> (file)");
var url = WScript.Arguments(0);
if (WScript.Arguments.length > 1) {
var saveTo = WScript.Arguments(1);
} else {
parts = url.split("/");
var saveTo = parts.slice(0, parts.length - 1);
//Fetch the file
var xhr = new ActiveXObject("MSXML2.ServerXMLHTTP");"GET", url, false);
if (xhr.status === 200) {
var stream = new ActiveXObject("ADODB.Stream");
stream.Type = 1; //adTypeBinary
stream.Position = 0; //Set the stream position to the start
var explorer = new ActiveXObject("Scripting.FileSystemObject");
if (explorer.Fileexists(saveTo)) { explorer.DeleteFile(saveTo); }

This comment has been minimized.

Copy link

Clicketyclick commented Jun 4, 2018

Please note: This only works with http: or https with the outdated TLS 1.0
TLS 1.2 is NOT a default secure protocol in WinHTTP in Windows:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.