WScript.Quit(x) and %ERRORLEVEL% Maximum Value
-
Tuesday, July 28, 2009 5:48 PMI'm sure this answer is buried somewhere and I'm just not seeing it. I've written a script to count the number of records in a text file and return the count via WScript.Quit(<recordcount>). The .BAT program that calls the script then checks %ERRORLEVEL% to see how many records were in the file and continues with processing.
My question: how large can the integer value be for WScript.Quit() and %ERRORLEVEL%? I've used this method for fairly large files, but want to know if I'm in danger of trying to count records using this method in a file that is too large.
Answers
-
Tuesday, July 28, 2009 7:11 PMModeratorIn older MS OSs the ERRORLEVEL was a single byte. Therefore the maximum value was 255. However, with the advent of WinNT4 and beyond, the ERRORLEVEL is now stored as a Long - that is, a four byte, signed integer; yielding maximum and minimum values of 2147483647 and -2147483648, respectively.
In other word, unless you have more than 2 Billion records in a file, you should be in good shape.
Tom Lavedas
Tom Lavedas- Proposed As Answer by Tom LavedasMicrosoft Community Contributor, Moderator Tuesday, July 28, 2009 7:11 PM
- Marked As Answer by IamMredMicrosoft Employee, Owner Friday, January 08, 2010 1:13 AM