Hi,
I would like to have two scripts, one of which calls the other, and have the
one that is called return a status value (set by the called script) to the
caller.

I assume I must use either Run or Exec from my 'master' script. True ?

Is there some way of using ExitCode for my purpose?

Thanks in advance,
Chris Hough

Re: Returning my own completion code from a VbScript by Torgeir

Torgeir
Wed Dec 01 11:01:32 CST 2004

Valerie Hough wrote:

> Hi,
> I would like to have two scripts, one of which calls the other, and have the
> one that is called return a status value (set by the called script) to the
> caller.
>
> I assume I must use either Run or Exec from my 'master' script. True ?
>
> Is there some way of using ExitCode for my purpose?
Hi

Main script:

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
iRC = oShell.Run("WScript.exe C:\Scripts\Second.vbs", 1, True)
WScript.Echo iRC
'--------------------8<----------------------


Content of Second.vbs:

'--------------------8<----------------------
' return error level 5
Wscript.Quit 5

'--------------------8<----------------------



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Re: Returning my own completion code from a VbScript by Valerie

Valerie
Wed Dec 01 12:51:33 CST 2004


"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:eX9Z9d81EHA.1860@TK2MSFTNGP15.phx.gbl...
> Valerie Hough wrote:
>
>> Hi,
>> I would like to have two scripts, one of which calls the other, and have
>> the one that is called return a status value (set by the called script)
>> to the caller.
>>
>> I assume I must use either Run or Exec from my 'master' script. True ?
>>
>> Is there some way of using ExitCode for my purpose?
> Hi
>
> Main script:
>
> '--------------------8<----------------------
> Set oShell = CreateObject("WScript.Shell")
> iRC = oShell.Run("WScript.exe C:\Scripts\Second.vbs", 1, True)
> WScript.Echo iRC
> '--------------------8<----------------------
>
>
> Content of Second.vbs:
>
> '--------------------8<----------------------
> ' return error level 5
> Wscript.Quit 5
>
> '--------------------8<----------------------
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx

Many thanks, the solution is as simple as I could have possibly hoped for!
Best regards,
Chris Hough