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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WScript.Quit error in Win98

Status
Not open for further replies.

rudejohn

IS-IT--Management
Jul 11, 2003
130
US
The code below is in a *.vbs file. I'm running the same code in WXP, W2K, and W98. It works in WXP and W2K, but not in W98. I run this code via a batch file designed to capture the exit code:

Dim WshShell, OSVer, objIE, objShell, fso, oArgs, temp1

'Set oArgs = WScript.Arguments
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("Shell.Application")

Const num1 = 1
Const num2 = 2

If num1 >= num2 Then
MsgBox("WScript.Quit(8)")
WScript.Quit(1)
Else
MsgBox("WScript.Quit(2)")
WScript.Quit(2)
End If



In W98, the batch file ALWAYS captures exit code 0 for some reason. I tried debugging using my advanced method of putting message boxes in the code... it appears to still be running ALL the code. I tried looking on MSDN and searching this site but I've been unable to find anything thus far. Any help would be greatly appreciated.

~RJ

Link to WScript on MSDN

************
RudeJohn
************
 
What version of Wscript are you running on the W9x ?

You can download an upgrade to verion 5.6 Here

Think that could be the problem...

Please tell me if I'm wrong I like to learn from my mistakes...
_____________________________________
Feed a man a fish and feed him for a day.
Teach a man to fish and feed him for a lifetime...
 
Okay, a colleague of mine here at the office answered my question for me.

Apparently when you run a *.vbs script in Windows98 through a DOS prompt, you have to start it like this:

start /w myfile.vbs

Otherwise it doesn't wait for user-interface or other application actions before continuing (thus I was getting the 0 error code all the time).

Thanks for your assistance!

************
RudeJohn
************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top