?
Solved

JSCRIPT - how to get the JSCRIPT to exit?

Posted on 2004-11-22
7
Medium Priority
?
3,426 Views
Last Modified: 2012-05-05
What is the syntax to get the JSCRIPT to exit ?

I tried this  and it works on Windows 2000 server but on Windows 2003 it just hangs ...


Wscript.Exit( 0)

Please advise what to do to get the script to exit on Windows 2003 machine.

Eagerly awaiting a response ..


Thanks.
0
Comment
Question by:sdesar
7 Comments
 
LVL 7

Expert Comment

by:Xxavier
ID: 12649161
exit what?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12649272
That is not a valid Method call: Wscript.Exit( 0)

You can Exit a loop, a function, a sub or a block of code.
Therefore you should create a Sub for the main exution block and exit that sub block if you want to exit main statements block.

0
 

Author Comment

by:sdesar
ID: 12649889
I have a JSCRIPT code - organise.js  the has this line

</OrganiseUsers>   // this is the end of the script.

In Windows 2002 when I run from the command line it exits fine -
the end tag gets printted on the command line and I get the

c:\> prompt.

But in Windows 2003 Server the  organise.js script runs and it
hangs at  -
</OrganiseUsers>

and NO c:\prompt.

How can I get the csript to exit the cscript ?



0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 63

Expert Comment

by:Zvonko
ID: 12652116
This not a JavaScript statement:
</OrganiseUsers>

Show please the complete script.
0
 
LVL 3

Expert Comment

by:andYetAnotherLoginName
ID: 12652210
MSDN2003:
----------------------------
Windows Script Host  

Quit MethodSee Also
Sleep Method

Applies To: WScript Object
Forces script execution to stop at any time.

object.Quit([intErrorCode])
Arguments
object
WScript object.
intErrorCode
Optional. Integer value returned as the process's exit code. If you do not include the intErrorCode parameter, no value is returned.
Remarks
The Quit method can return an optional error code. If the Quit method is the final instruction in your script (and you have no need to return a non-zero value), you can leave it out, and your script will end normally.

Example
The following JScript code snippet quits execution and returns an error code of 1:

WScript.Quit (1);

// This line of code is never executed.
var i = 0;
----------------------------

Again, MSDN2003:
----------------------------
Windows Script Host  

WScript Object Properties and MethodsProperties
Arguments Property
BuildVersion Property
FullName Property
Interactive Property
Name Property
Path Property
ScriptFullName Property
ScriptName Property
StdErr Property
StdIn Property
StdOut Property
Version Property

Methods
ConnectObject Method
CreateObject Method
DisconnectObject Method
Echo Method
GetObject Method
Quit Method
Sleep Method
----------------------------

as you see, there is no "Exit" method in the reference dated by 2003 :(
0
 
LVL 3

Expert Comment

by:azcn2503
ID: 12652534

!?
0
 
LVL 3

Accepted Solution

by:
andYetAnotherLoginName earned 200 total points
ID: 12652547
in plain english: WScript.Quit(1);
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question