Get Dos errorlevel

 BBS: Inland Empire Archive
Date: 02-24-94 (23:19)             Number: 319
From: GARY GLUECKERT               Refer#: NONE
  To: HARRY F. HARRISON             Recvd: NO  
Subj: Get Dos errorlevel             Conf: (2) Quik_Bas
HFH> > Help! I've been trying to find a way to get the dos errorlevel and am
HFH> > having some problems. I'm using INT 21H, AH=4DH as shown below. This
HFH> > interrupt is known as the GET Child-Program Return Value and is

HFH>The problem is this:

HFH>COMMAND.COM always returns 0.

HFH>Harry

The DOS errorlevel is stored in an interrupt in memory and is not reset
by another copy of command.com. Remember also that not all of
Command.com is transient. Here is a snippet of code I finally found
written in QB that should illustrate the point.

FUNCTION ErrorLevel% ()

   'Purpose : To check the error level of a program returning from shell
   'Input   : none (well, helps if you did shell a program first)
   'Return  : The errorlevel returned from the last shelled program

   DEF SEG = 0
   ErrorLevel% = PEEK(&H4FE)
   DEF SEG
END FUNCTION

This was found in a file named QBFAQR01.ZIP I found on the Shareware
Studio Volume II CD-ROM. The FAQR actually stands for Frequently Asked
QucikBasic Routines and from what I read  it seems as though this echo
conference has everything to do with it. If anyone knows of a later
version of this file please let me know where I can FREQ it from.

For now you may FREQ this file from 1:107/270 with the MAGIC name of
FAQR or you may download it from SUNY Online Services 516-420-0818.

Gary
$$64
---
 þ OLX 2.1 þ Yeah, Right, Uh-huh, Of Course, Hmmm........... Yawn

--- MsgToss 2.0c
 * Origin: The State University of New York at Farmingdale (1:107/270)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET