[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting variable based on errorlevel under DOS

From: Eli Zaretskii
Subject: Re: setting variable based on errorlevel under DOS
Date: Wed, 26 Oct 2005 08:54:01 +0200

> From: address@hidden
> Date: Tue, 25 Oct 2005 16:16:21 -0700
> I have an issue where I need to set the value of a variable based on  
> the errorlevel set by a command and access it in a makefile.
> I am using the 3.81 beta compiled for DOS
> I want to be able to test the exit status of a command like this
> include gmsl
> all:
>      address@hidden /t || if errorlevel 0 cmd /c "set status=1"
>      $(if $(status),@echo failed,@echo success)
> So that if myprogram fails I can set the value of status to 1 and  
> then test $status later
> Can this be done in this way or am I way off base. I am not a DOS  
> expert so I am at a bit of a loss on how to do this

Try this:

        address@hidden /t
        @if not errorlevel 0 echo success

Note that tests of the errorlevel value are actually >= tests.  That
is "if errorlevel N" actually tests that the exit code is N or

reply via email to

[Prev in Thread] Current Thread [Next in Thread]