Hi there,
I have 6 vbs scirpts which I would like to run from a
batch file however I need them run in sequence so that
the first vbs script completely finishes before the second
one is exicuted. I am finding this will not work with a
batch file because the batch file will not wait for the
first one to finsish before running the second one. And
putting a delay counter won't work either because the
scripts do not always take the same amount of time to run.

My question is how can I use a vbs script to run each of
my 6 other vbs scripts One at a time and have the 2nd vbs
script not start exicuting untill the first vbs script is
completed and so on ......

Any thoughts ???

Thanks in advance Dan Thompson

Re: Using VBS to Run Multi vbs Scripts by Joe

Joe
Fri Jul 04 16:24:54 CDT 2003

Hi,

"DAN-O" <danthompson@kpmg.ca> wrote in message
news:033001c34270$420351b0$a301280a@phx.gbl...
> Hi there,
> I have 6 vbs scirpts which I would like to run from a
> batch file however I need them run in sequence so that
> the first vbs script completely finishes before the second
> one is exicuted. I am finding this will not work with a
> batch file because the batch file will not wait for the
> first one to finsish before running the second one. And
> putting a delay counter won't work either because the
> scripts do not always take the same amount of time to run.
>
> My question is how can I use a vbs script to run each of
> my 6 other vbs scripts One at a time and have the 2nd vbs
> script not start exicuting untill the first vbs script is
> completed and so on ......
>
> Any thoughts ???
>
> Thanks in advance Dan Thompson

Run a single vbs file from the bat file. Run the six vbs files from the
central vbs file using the Run method with a wait for completions flag.

set oShell= createobject("wscript.shell")
oShell.run "wscript.exe ""path to vbs\file.vbs"" arguments", [window code],
true

The vbs will wait for the called secondary vbs to complete before calling
the next one. Run can also be used as a function to return a long integer
from the called secondary vbs through the Quit(n) method.

FWIW, if you don't really need the 6 vbs files to be separate, consider
making them procedures in your central vbs -- it saves on the sanity factor.

Joe Earnest




Re: Using VBS to Run Multi vbs Scripts by Tom

Tom
Sat Jul 05 09:39:50 CDT 2003

That is the correct Script centric answer. The poster
appears to be batch centric (login process on pre-XP?).

I believe the batch centric answer is to explicitly invoke
the Cscript.exe host rather than name the .vbs scripts
directly (which almost certainly invokes Wscript.exe as
the host). If that doesn't solve the problem, then add
the //B (batch) command switch to each script invocation
line in the batch. If for some reason that doesn't work,
there is always the /W (wait) switch of the START utility.

For example, ...

cscript pathspec\script1st.vbs

or, in necessary

cscript //b pathspec\script1st.vbs

or, in necessary

start /wait cscript pathspec\script1st.vbs

Tom Lavedas
===========

>-----Original Message-----
>Hi,
>
>"DAN-O" <danthompson@kpmg.ca> wrote in message
>news:033001c34270$420351b0$a301280a@phx.gbl...
>> Hi there,
>> I have 6 vbs scirpts which I would like to run from a
>> batch file however I need them run in sequence so that
>> the first vbs script completely finishes before the
second
>> one is exicuted. I am finding this will not work with a
>> batch file because the batch file will not wait for the
>> first one to finsish before running the second one. And
>> putting a delay counter won't work either because the
>> scripts do not always take the same amount of time to
run.
>>
>> My question is how can I use a vbs script to run each of
>> my 6 other vbs scripts One at a time and have the 2nd
vbs
>> script not start exicuting untill the first vbs script
is
>> completed and so on ......
>>
>> Any thoughts ???
>>
>> Thanks in advance Dan Thompson
>
>Run a single vbs file from the bat file. Run the six vbs
files from the
>central vbs file using the Run method with a wait for
completions flag.
>
>set oShell= createobject("wscript.shell")
>oShell.run "wscript.exe ""path to vbs\file.vbs""
arguments", [window code],
>true
>
>The vbs will wait for the called secondary vbs to
complete before calling
>the next one. Run can also be used as a function to
return a long integer
>from the called secondary vbs through the Quit(n) method.
>
>FWIW, if you don't really need the 6 vbs files to be
separate, consider
>making them procedures in your central vbs -- it saves on
the sanity factor.
>
>Joe Earnest
>
>
>
>.
>

Re: Using VBS to Run Multi vbs Scripts by Joe

Joe
Sat Jul 05 13:17:46 CDT 2003

Hi Tom,

Good point. I tend not to think "batch centric". (I like the terminology.)

Regards,
Joe Earnest