Problem running multiple lwp-download commands from a Windows batch file

B

Bruce Horrocks

Dear All,

This surely must be a FAQ or at least a known bug but according to
Google (web and groups) it isn't, so please bear with me...

I'm using ActivePerl 5.8 under Windows 2000 [1]

I wish to download about 50-odd PDF files from a web-site. I have the
URLs of all of them so I created a Windows .BAT file containing 50-odd
lines, each of the form:

lwp-download "http://www.example.com/path/file.pdf" file.pdf

When I run the .BAT file from a command window, it executes the first
lwp-download command perfectly, saving a working PDF file, and then
stops.

No matter what I do it always terminates execution of the batch file
after the first lwp-download. I tried changing them to GETs instead but
the same thing happens.

Is there a work-around and if so what is it?

Thanks in advance.

[1] And have been for a while so if it's an installation problem then
sorry, but I can't remember what options I chose. :)
 
J

Jay Tilton

: This surely must be a FAQ or at least a known bug but according to
: Google (web and groups) it isn't, so please bear with me...
:
: I'm using ActivePerl 5.8 under Windows 2000 [1]
:
: I wish to download about 50-odd PDF files from a web-site. I have the
: URLs of all of them so I created a Windows .BAT file containing 50-odd
: lines, each of the form:
:
: lwp-download "http://www.example.com/path/file.pdf" file.pdf
:
: When I run the .BAT file from a command window, it executes the first
: lwp-download command perfectly, saving a working PDF file, and then
: stops.
:
: No matter what I do it always terminates execution of the batch file
: after the first lwp-download. I tried changing them to GETs instead but
: the same thing happens.

The fault lies with Windows batch file processing, not with Perl.

Calls to "lwp-download" really call "lwp-download.bat" , which was created
from the lpw-download Perl program by the pl2bat utility.

When one .bat file (the one you created) calls another .bat file
(lwp-download), by default the called batch file replaces the caller.
Control never returns to the original batch file.

You can override this default behavior with the "call" keyword, e.g.

call lwp-download "http://www.example.com/path/file.pdf" file.pdf
call lwp-download "http://www.example.com/path/file2.pdf" file2.pdf
call lwp-download "http://www.example.com/path/file3.pdf" file3.pdf
...
 
G

Gregory Toomey

It was a dark and stormy night, and Bruce Horrocks managed to scribble:
Dear All,

This surely must be a FAQ or at least a known bug but according to
Google (web and groups) it isn't, so please bear with me...

I'm using ActivePerl 5.8 under Windows 2000 [1]

I wish to download about 50-odd PDF files from a web-site. I have the
URLs of all of them so I created a Windows .BAT file containing 50-odd
lines, each of the form:

Instead of Perl, I would use wget for windows (horses for courses)

http://wget.sunsite.dk/
ftp://ftp.gnu.org/pub/gnu/wget/.

lwp-download "http://www.example.com/path/file.pdf" file.pdf

When I run the .BAT file from a command window, it executes the first
lwp-download command perfectly, saving a working PDF file, and then
stops.

No matter what I do it always terminates execution of the batch file
after the first lwp-download. I tried changing them to GETs instead but
the same thing happens.

That's because Windows is written by morons.
Is there a work-around and if so what is it?

Get a unix variant.

gtoomey
 
B

Bruce Horrocks

Jay Tilton said:
The fault lies with Windows batch file processing, not with Perl.

Calls to "lwp-download" really call "lwp-download.bat" , which was
created from the lpw-download Perl program by the pl2bat utility.

When one .bat file (the one you created) calls another .bat file
(lwp-download), by default the called batch file replaces the caller.
Control never returns to the original batch file.

You can override this default behavior with the "call" keyword, e.g.

Ah yes, I think I knew that at one time but had forgotten.

Many thanks - it is downloading fine as I type.

Happy New Year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top