How do I invoke a vbscript from within a vbscript. For
example: I have Main.vbs, One.vbs, and Two.vbs. I would
like Main.vbs to invoke first One.vbs and then Two.vbs.
What's the right way to do this?

Re: Script within script - nesting scripts by Joe

Joe
Wed Oct 22 10:55:16 CDT 2003

Hi,

"Chad" <anonymous@discussions.microsoft.com> wrote in message
news:07f001c398b2$1da4dc10$a001280a@phx.gbl...
| How do I invoke a vbscript from within a vbscript. For
| example: I have Main.vbs, One.vbs, and Two.vbs. I would
| like Main.vbs to invoke first One.vbs and then Two.vbs.
| What's the right way to do this?

The simplest way is probably to use the Run method of the WScript object and
run them just like any other file or app. The Run command will optionally
wait for completion, and you can pass arguments if needed. Look up "Run" in
the index of the WSH CHM file documentation.

http://www.microsoft.com/downloads/search.aspx?displaylang=en
The MS Download Center (English Language)

http://www.microsoft.com/downloads/results.aspx?productID=478EA476-5552-479E-A200-2C33FFD43F24&freetext=&DisplayLang=en
WSH Updates, Documentation and Utility Downloads (English Language)

http://www.microsoft.com/downloads/details.aspx?FamilyID=01592c48-207d-4be1-8a76-1c4099d7bbb9&DisplayLang=en
Windows Scripting Documentation Download (English Language)

For WSH downloads in languages other than English, click on The MS Download
Center link, then select the desired language and click the Go button in the
Worldwide Downloads drop-down box. Once in the appropriate language, select
the equivalent of the Windows Script category in the Product/Technology
drop-down box, and then click the Go button in that box.

Joe Earnest



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03



Re: Script within script - nesting scripts by Joe

Joe
Wed Oct 22 11:02:53 CDT 2003

oops, typo ...

The WshShell object, not the WScript object, itself.

set oWshShell= createObject("wscript.shell")

Joe Earnest


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03



Re: Script within script - nesting scripts by Chad

Chad
Wed Oct 22 11:26:00 CDT 2003

Perfect. Thanks!

>-----Original Message-----
[*snip*]
>The simplest way is probably to use the Run method of
the WScript object and
>run them just like any other file or app. The Run
command will optionally
>wait for completion, and you can pass arguments if
needed. Look up "Run" in
>the index of the WSH CHM file documentation.
[*snip*]

Script within script - nesting scripts by Bryan

Bryan
Thu Oct 23 15:56:28 CDT 2003

There are dozens of ways to skin that cat, but I'm
guessing you are looking for the cheapest-n-easiest way.
I would use:

Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run SCRIPT_ENGINE & " script1.vbs"

(I'm roughing this in for you - you can use WSH to find
the path of your scripting engine and you would want to
path your run-script too.)

My sugg assumes you want to return to execution in the
source script after the call is done? You can also read
up on the RUN method for parameters to execute and wait
for a finish or execute in the background.

BK

>-----Original Message-----
>How do I invoke a vbscript from within a vbscript. For
>example: I have Main.vbs, One.vbs, and Two.vbs. I would
>like Main.vbs to invoke first One.vbs and then Two.vbs.
>What's the right way to do this?
>.
>