http%3a%2f%2fdownload.microsoft.com%2fdownload%2f8%2f4%2fA%2f84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14%2fdirectx_Jun2010_redist.exe
instead of what it was:
http://download.micr...2010_redist.exe
Anyone have any ideas if/how this coding can be handled in batch? Especially how to pass this - http%3a%2f%2fdownload.microsoft.com%2fdownload%2f - in a variable? I guess the best/most flexible way might be to try to find the link first using the friendly "http://download" type format, and if not found to change ":" to "%3a" and "/" to "%2f" and search again, and if found convert "%3a" and "%2f" back to ":" and "/" in order to end up with a usable link for wget. But I'm embarrassed to say that I've been away from batch coding long enough that I'm drawing a blank how best to handle all the manipulations of "%" required. Could anyone please remind me or help with the rewrite?
Here is the ReadMe for the file:
Quote
Download -
Written By - bphlpt - Well, mostly by dumpydooby, with influences by vmanda
and Pasha_ZZZ, while cheered on by 5eraph, alban, and
user_hidden, while YumeYao waved from the background.
Version - 1.5.0
Date - 2010-11-01
Download "%_DownloadPage%" "%_LinkStart%" "%_LinkEnd%" "%_DownloadWhere%"
["%_StatusOut%"]
The first four argumnets are Required, and the fifth is optional. They are:
"%_DownloadPage%" - The web page where the download link is located.
"%_LinkStart%" - The first part of the link you want to match.
"%_LinkEnd%" - The last part of the link you want to match.
"%_DownloadWhere%" - Where the downloaded file should be stored.
"%_StatusOut%" - This can be any valid redirection path - filename, the
console, or even nul. If this argument is omitted, the
StdOut, or console, is used.
NOTE: Each argument should be enclosed with quotes ["]
This program finds a download link specified as "%_LinkStart%***%_LinkEnd%"
on the web page "%_DownloadPage%" and downloads that file to
"%_DownloadWhere%" using wget. It has been tested to work using XP and Win7
specifically for Microsoft's DirectX download page.
This program began from my need for this funtion by my "DirectX file
Collector and addon Builder", see here -
"http://www.ryanvm.net/forum/viewtopic.php?p=108233". dumpydooby suggested
adding the function, and after I was originally unsuccessful in its
implementation, vmanda came up with a great tool that filled the need. But I
was stubborn and still wanted to do my own version. As I was just starting
to experiment with VBScript, Pasha_ZZZ provided a perfect tool using JScript.
But before I had time to roll out the DXCB including Pasha_ZZZ's great code,
dumpydooby came back with essentially the same code in VBScript but with
enhanced wget funcionality. That became the basis for this code. I merely
shined it up a bit, generalized it, added a variable output stream, added
error checking and documentation, and corrected a few "gotcha's" we've all
learned from. 5eraph, alban, user_hidden, and YumeYao helped immeasurably
with testing. This would not have been possible without the help of
everyone mentioned.
Dependencies: wget must be located in the same directory as this file and the
first four arguments specified above must be defined.
Upon Exit, ERRORLEVEL is set to 0 if all went well, 1 if no links were found,
and 2 if there was a problem trying to download the link with wget.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an example of a way to use Download:
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
(SET _DownloadPage="http://go.microsoft.com/fwlink/?LinkID=56511&clcid=0x409")
(SET _LinkStart="http://download.microsoft.com/download/")
(SET _LinkEnd="_redist.exe")
(SET _DownloadWhere="%CD%")
(Call Download %_DownloadPage% %_LinkStart% %_LinkEnd% %_DownloadWhere% con)
Exit /B 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any download link in the format "%_LinkStart%***%_LinkEnd%" that is found on
"%_DownloadPage%" will be downloaded by wget and put "%_DownloadWhere%" unless
the file already exists there and has a date code no older than that of the file
on the "%_DownloadPage%". In this example, status will be provided on the
StdOut, or "con", including a running status in the Title bar.
The download includes:
Download.cmd
wget.exe
ReadMe.txt
Changelog:
2010-11-01 -- Version 1.5.0 -
Improved reliability of Downloader with code tweaks
2010-09-13 -- Version 1.0.0 -
Initial Release
Thanks in advance for any and all suggestions anyone can provide.
Cheers and Regards
Attached File(s)
-
Download.cmd (9.88K)
Number of downloads: 8



Help

Back to top









