How to generate exit code using vbscript other that wscript.quit ?

I have 3 part in a single vbscript and for each part , i have to generate exit code. So Please help.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0
Try WScript.Quit(1), WScript.Quit(2), WScript.Quit(3). Replace the numbers with your choice.
Answered 11/01/2014 by: flip1001
Fourth Degree Green Belt

Please log in to comment
0
if i use wscript.quit (1), it will stop , will not execute the code after that.
Answered 11/01/2014 by: p.d.das
Senior White Belt

  • Golly! You told the script engine to quit and none of the code after that statement got executed. Imagine that!
  • Are you serious? To generate an EXIT code, your application has to EXIT. One of the notable features of code execution is that it STOPS when you EXIT!
    You really need to think carefully about what you need your code to do before posting truly bizarre comments about your expectations....<g>
Please log in to comment
0
Here's a contrived example of how you might do this.

1/ Copy and paste the example code into notepad and save to a file with a .vbs extension
2/ Open a Windows command prompt.
3/ Change directory (cd) to the path containing the .vbs file
4/ Type cscript //nologo file.vbs

Example code:
Option Explicit
Dim myName, myExitCode

myName = "Bob"

Select Case myName
Case "Bob"
myExitCode = 1
Case "Sara"
myExitCode = 1
Case "Charles"
myExitCode = 0
End Select

WScript.Quit myExitCode

To check the error level type echo %ERRORLEVEL%<CR>. Edit and save the myName variable value in the vbs file and observe the change in exit code after typing echo %ERRORLEVEL%<CR>.
Answered 06/28/2015 by: Jimadine
White Belt

Please log in to comment
This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

Answer this question or Comment on this question for clarity