JSCRIPT - how to get the JSCRIPT to exit?

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 ..

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

exit what?
ZvonkoSystems architectCommented:
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.

sdesarAuthor Commented:
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  -

and NO c:\prompt.

How can I get the csript to exit the cscript ?

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ZvonkoSystems architectCommented:
This not a JavaScript statement:

Show please the complete script.
Windows Script Host  

Quit MethodSee Also
Sleep Method

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

WScript object.
Optional. Integer value returned as the process's exit code. If you do not include the intErrorCode parameter, no value is returned.
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.

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

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 :(

in plain english: WScript.Quit(1);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.