Message-ID: <000c01c121b3$eb0c50c0$8708e289@mpaul> From: "Matthias Paul" To: References: Subject: Re: more on the batch file problem Date: Fri, 10 Aug 2001 08:52:43 +0200 Organization: University of Technology, RWTH Aachen, Germany MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id LAA17613 Reply-To: opendos AT delorie DOT com On 2001-08-09, Donald Pedder wrote: > The file itself is fine. It's hard to get these words out > of my mouth, but it works perfectly with MS-DOS, and not > with DR-DOS. :-\ Itīs hard to believe until I can see prove for it myself... ;-) IF ERRORLEVEL and other errorlevel related extensions work very reliable for me, but - not specific to DR-DOS - there are several pitfalls in the general design of this DOS command, which can sometimes cause grief, when not taken into account. As Arkady suggested already, the errorlevel used for IF ERRORLEVEL and the like is not normally changed by so called "internal commands", that is commands built into COMMAND.COM. This is the same for MS-DOS/PC DOS as it is for DR-DOS. So, the errorlevel will depend on the last external command executed before the batchfile runs into your query. I would think that this external tool returns different errorlevels at times, maybe, if its one of the external DOS commands, like XCOPY, they return different errorlevels in similar situations, or the return different errorlevels due to the fact that running under different OSes imposes a different software environment... Maybe something you do not think of anymore in the context of the COPY command??? I would like to ask you to possibly strip down your batchfile to a minimum, just to demonstrate the different behaviour under different OSes, then post it here (, or at your option send it to be via private mail), so we can all learn about it. But without an example, thereīs not much we can do - except for creating rumours... It might also be a good idea to try to run the batchfile under MS-DOS, but with the DR-DOS COMMAND.COM loaded instead of their original COMMAND.COM. Letīs see if you can reproduce the behaviour under MS-DOS then. Assuming the errorlevel is set by an external command, you can use something like ECHO Errorlevel: %errorlevel% (or %errorlvl%) IF ERRORLEVEL 1 GOTO error IF NOT EXIST filespec GOTO nofile COPY filespec ... to display the current errorlevel. %errorlevel% exists since Novell DOS 7 COMMAND.COM, the functional very similar %errorlvl% system variable exists since DR-DOS 7.02+. Under DR-DOS 7.02+ COMMAND.COM you can also use EXIT [errorlevel] to force a specific errorlevel, as follows: IF "DRDOS"=="%OS%" IF NOT ""=="%errorlvl%" COMMAND /C EXIT 0 IF ERRORLEVEL 1 GOTO error ; should never happen under DR-DOS 7.02+ here IF NOT EXIST filespec GOTO nofile COPY filespec ... (Future issues should also support the RETURN [errorlevel] syntax: IF "DRDOS"=="%OS%" GOSUB sub IF NOT EXIST filespec GOTO nofile COPY filespec ... GOTO eof :sub RETURN 0 :eof but DR-DOS 7.02/7.03 COMMAND.COM did not.) For an overview of known errorlevels returned by external commands under various operating systems, please have a look at the BATTIPS.TXT file from the MPDOSTIP.ZIP archive available on my web-site and other places. You claimed other syntactical or semantical differences between the two command processors, would you like to elaborate on this? I mean, DR-DOS COMMAND.COM has many improvements over the MS-DOS one, hence they just cannot be 100% compatible - but even COMMAND.COM of different MS-DOS versions are not 100% compatible with each other... What kind of feature are you missing under DR-DOS COMMAND.COM specifically? Greetings, Matthias -- Matthias Paul, Ubierstrasse 28, D-50321 Bruehl, Germany ; http://www.uni-bonn.de/~uzs180/mpdokeng.html; http://mpaul.drdos.org