/build/static/layout/Breadcrumb_cap_w.png

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

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

Answers (3)

Posted by: flip1001 9 years ago
Black Belt
0
Try WScript.Quit(1), WScript.Quit(2), WScript.Quit(3). Replace the numbers with your choice.
Posted by: p.d.das 9 years ago
Senior White Belt
0
if i use wscript.quit (1), it will stop , will not execute the code after that.

Comments:
  • Golly! You told the script engine to quit and none of the code after that statement got executed. Imagine that! - anonymous_9363 9 years ago
  • 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> - EdT 9 years ago
Posted by: Jimadine 8 years ago
White Belt
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>.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ