|
Answer» Hi there, is there any way I can download a file from a webserver trough batch (under winxp/vista) I made a batch file that creates the following VBSCRIPT (and launches it): End Sub
The script works like a charm for files less then 50 kb, but I want to download a file that is 450 kb.
Can anyone please help me
P.S. Installing external command line tools isn't an option, cause I can't install anything elseYou appear to be hitting a maximum buffer size that is more like 64k instead of 50k. You will likely have to write the 64k buffer prior to reaching 64k and then grab the other 63 or 64 k and perform another write appended to the end of file of the first write until the entire file is transferred. Not sure if this can be done and keep the handshake of the download or if the delay in writing will error that possibility out.
- OR - find a way to use a buffer other than the default without the 64k limit. In a PERL script on google a person stated that they changed from 64k to 2GB Buffer by switching between Win32::Textfield to Win32::RichEdit. This wont help you directly with your code, but sounds like the same issue, but a different language. ** For 2GB obviously you need resources to support that.
Other possibility is a limitation in the dos-shell buffer of windows that I didnt dig up any info on.
Windows caches downloads prior to writing to the hard drive so maybe there is an API call... although if you are going into API territory its further away from a batch than you probably want to be since you wanted to do this in batch.
wait a minute- ever since VB MOVED from 16-bit to 32-bit and dumped HLSTR's in favour of BSTR's it has had a maximum string size of 2GB...
Also- Why not write out the entire responsebody? I'm not sure exactly what the loop is trying to do- but couldn't you simply do:
Code: [Select]objfile.write objHTTP.ResponseBody
and, if it's converting to or from UNICODE you could use the StrConv() function.
Also- what exactly happens with files that are larger then 50K... (or 64K)
Quote from: BC_Programmer on JUNE 02, 2009, 02:05:37 PM wait a minute- ever since VB moved from 16-bit to 32-bit and dumped HLSTR's in favour of BSTR's it has had a maximum string size of 2GB...
Also- Why not write out the entire responsebody? I'm not sure exactly what the loop is trying to do- but couldn't you simply do:
Code: [Select]objfile.write objHTTP.ResponseBody
and, if it's converting to or from unicode you could use the StrConv() function.
Also- what exactly happens with files that are larger then 50K... (or 64K)
Thank you for your responses. After looking a long time i have found the following script which works perfectly, but I only have one problem. It promps with an useless textbox to say where the file is saved. This ins't really user-friendly because the user doesn't need to be BOTHERED which such information imo. Does anyone now how to avoid the message box?
Thanks in advance
script: End Function you can use wget too
Quote from: devcom on June 02, 2009, 02:58:10 PMyou can use wget too
except:
QuoteP.S. Installing external command line tools isn't an option, cause I can't install anything else
|