Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598
Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598
Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598
Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598
Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598
I ran into a problem recently with my windows batch script files because I use this great utility called URL2FILE.exe which is a free 32bit Windows console-mode application able to retrieve and save the content of a World Wide Web content to a local file. Well, for some unknown reason our company virus scan software, VirusScan, decided that URL2FILE.exe was a Generic PUP.z virus and cascade deleted all copies of the file on our server! In an instant all my services that use the file was rendered useless!
With limited knowledge of Windows Script Hosting and VbScript, I’ve managed to write up a small vbscript file that pretty much does what url2file aims to do with text files (please note that the script does NOT work with binary files). To effectively create a script that replicates the download of web pages similar to what url2file.exe does, then do the following:
Download and install Windows script hosting from:
Save the following code as URL2FILE.vbs:
'Arguments 'Wscript.Arguments(0) - Website URL 'Wscript.Arguments(1) - Full File Path Dim lngResolveTimeout, lngConnectTimeout, lngSendTimeout, lngReceiveTimeout, retVal '30 Min timeout when accessing web page lngResolveTimeout = 1800000 lngConnectTimeout = 1800000 lngSendTimeout = 1800000 lngReceiveTimeout = 1800000 'Valid URL continue validation Dim xml, txresponse Set xml = CreateObject("MSXML2.ServerXMLHTTP") xml.setTimeouts lngResolveTimeout, lngConnectTimeout, lngSendTimeout, lngReceiveTimeout xml.Open "GET", Wscript.Arguments(0), False xml.Send 'Write response to file Dim oFs, oTextFile, iMode iMode = 2 set oFs = createobject("Scripting.FileSystemObject") set oTextFile = oFs.OpenTextFile(Wscript.Arguments(1), iMode, True) oTextFile.Write xml.responseText oTextFile.Close set oTextFile = nothing set oFS = nothing
To run the script in a command prompt session:
url2file.vbs [URL] [FULL OUTPUT FILE PATH]
eg. url2file.vbs http://localhost/test.htm c:\temp\test.htm