Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a vbscript from a batch.

Status
Not open for further replies.

romualdt

Technical User
Apr 26, 2002
2
US
Trying to convert a bunch of old batch files to vbscript.

Have several batch files that call other batch files and pass the reults into a varriable. Like this: "Call Somebatchfile.bat %1" Somebatchfile.bat goes off does it's thing and returns a value. Then the rest of the original batch file can now use the %1 varriable.

trying to replace Somebatchfile.bat with someVBS_Script.vbs

I can not seem to get the vbscript to pass back a value to the batch file after it runs.

 
Vbscript can only return an exit code to the program that called it. The exit code can only be numeric, but I have used it to return pre-determined values to the calling script. To return a code of 999 for instance, exit your vbscript with:

wscript.quit 999

the calling script would need to put the call to a variable for the exit code to be usefull. i.e.

Set Shell = CreateObject("Wscript.Shell")
Program = "adifferentvbscript.vbs"
ReturnCode = Shell.Run (Program, 1, True)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top