BBS: Inland Empire Archive Date: 02-19-94 (11:37) Number: 234 From: PAUL MONACO Refer#: 188 To: HARRY F. HARRISON Recvd: NO Subj: Get Dos errorlevel Conf: (2) Quik_Bas
*** Quoting Harry F. Harrison to Gary Glueckert dated 02-15-94 *** > > Help! I've been trying to find a way to get the dos errorlevel and am > > having some problems. I'm using INT 21H, AH=4DH as shown below. This > > interrupt is known as the GET Child-Program Return Value and is > > The problem is this: > > COMMAND.COM always returns 0. > > Harry I think what he ment was someithing like this (off the top of my head) open "temp.bat" for output as #1 print #1, "DSZ rs 9600 etc etc etc.." print #2 "IF ERRORLEVEL = 2 GOTO FAIL" print #1, "IF ERRORLEVEL = 1 GOTO PASS" print #1, "FAIL:" print #1, "ECHO 2 > EXIT.DAT" print #1, "GOTO END" print #2, "PASS 1 > EXIT.DAT" print #1, "GOTO END" print #1, "END:" print #1, "EXIT" close #1 SHELL "TEMP.BAT" OPEN "EXIT.DAT" for input as #1 input #1,E_LEVEL$ close #1 KILL "TEMP.BAT" KILL "EXIT.DAT" Print "Your errorlevel is =";E_LEVEL$ end Got a little sloppy with my print #1's (they should have all been #1, but a few #2's crept in there), anyway you get the idea, havn't tried it but it should more or less work. $$56 --- T.A.G. 2.6f1 Standard * Origin: CyberJett Technologies BBS (1:142/710)
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