How can I grab a file off the web from DOS

Miscellaneous Forums/General Discussion/How can I grab a file off the web from DOS

I'm working on some DOS batch files. And one of them needs an updated file from the internet. The address of this file doesn't really change but needs to be downloaded manually as we don't know how to script the download.

can I do something like:

iexplore.exe http://mysite/myfile.dat > c:\files

I don't think that works but would be great if it did.

write a tool in Bmax to download the file?

yeah, I could use blitz3D (I don't have bmax), but this is a customers system where they don't want any extra programs installing, so need to really do this using in-built windows functions.

I know how to do it in linux if thats any help (gets text from a site and echoes it to screen or file) :/

Out of interest have you tried:
type "http://www.domain.com/file.htm" > mytext.txt
Might work...

Logically thinking, if installers, trojans etc.. can download stuff using the resources available then you should be able to too.

you're going to give them the batch file, just give them your exe with it. whats so bad about that? (except that if you use b3D it'll be 1.4mb in sizr...)

nevermind, I've noticed the file can also be got at via ftp, so I'm writing an ftp script that seems to be working so far. And I'm getting that buzz you get from solving a problem.

you could create a batch file that calls ftp -s:yourftpcommands.txt
then you could either have it load on startup or simply add it to the scheduler to automate it.

Try wget

He didn't want to install any apps, and ftp already exists as a DOS application.

But yes, wget would have been my suggestion otherwise, I just today wrote a shell script to download the latest version of YUI onto my work's server, unzip it and place it in the appropriate directory

thanks guys, I've got it working using a script file for ftp calling it using -s:"script.txt", works great.

Sometimes old fasioned solutions work best.

For the protocol: You guys are not using DOS applications, but Win32 console applications. They might look the same, but are a different pair of shoes. And you are also not on a DOS prompt (as you were in Win9x), but on a Windows console.

What Winni said.

Darkheart

Yes, I know it's not really DOS but for the sake of simplicity and lack of pedantry, I call it DOS.

He didn't want to install any apps, and ftp already exists as a DOS application.
You don't have to "install" wget. How anyone can live without it I'll never know.