how to set time limit to run command in batch file

R

Ray

Hello,

I have a batch file to download a list of web links regularly,
each of the the web resource is named by sequential number,
eg, 101.htm, 102.htm, 103.htm, etc.
So, I use a integer variable to record the current web file to be download
and combine them together to the command line.
However, it may occur unlimited waiting when one of the web resource is
unavailable.
So, I am looking for any utility to launch each of the download command with
a specified time limit.
When the time limit is reached, end the current process automatically and
execute the next command.

here is a utility to run command with delay
http://www.rjlsoftware.com/software/utility/delayexec/
That's the way I am looking the function is run command with time limit.
If anyone have any good idea, please feel free and thank u to notice me.

Thanks all of you spending the time to see my post,
Thank you very much!
 
P

Pegasus \(MVP\)

Ray said:
Hello,

I have a batch file to download a list of web links regularly,
each of the the web resource is named by sequential number,
eg, 101.htm, 102.htm, 103.htm, etc.
So, I use a integer variable to record the current web file to be download
and combine them together to the command line.
However, it may occur unlimited waiting when one of the web resource is
unavailable.
So, I am looking for any utility to launch each of the download command with
a specified time limit.
When the time limit is reached, end the current process automatically and
execute the next command.

here is a utility to run command with delay
http://www.rjlsoftware.com/software/utility/delayexec/
That's the way I am looking the function is run command with time limit.
If anyone have any good idea, please feel free and thank u to notice me.

Thanks all of you spending the time to see my post,
Thank you very much!

You could run this batch file. It will allocate about
one minute for the task defined in line 2.

@echo off
set app=download.exe
set limit=60
if not "%1"=="" goto Delay

start /B %0 x
%app% www.xxx.yyy.zzz 101.htm

start /B %0 x
%app% www.xxx.yyy.zzz 102.htm

start /B %0 x
%app% www.xxx.yyy.zzz 103.htm
goto :eof
========================
:Delay
ping localhost -n %limit% > nul
taskkill /im /f %app%
exit
 
R

Ray

yes, thank you very much.

Pegasus (MVP) said:
You could run this batch file. It will allocate about
one minute for the task defined in line 2.

@echo off
set app=download.exe
set limit=60
if not "%1"=="" goto Delay

start /B %0 x
%app% www.xxx.yyy.zzz 101.htm

start /B %0 x
%app% www.xxx.yyy.zzz 102.htm

start /B %0 x
%app% www.xxx.yyy.zzz 103.htm
goto :eof
========================
:Delay
ping localhost -n %limit% > nul
taskkill /im /f %app%
exit
 

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

Top