[Top][All Lists]

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

Re: setting variable based on errorlevel under DOS

From: Alessandro Vesely
Subject: Re: setting variable based on errorlevel under DOS
Date: Wed, 26 Oct 2005 09:34:07 +0200
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

address@hidden wrote:
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

    address@hidden /t || if errorlevel 0 cmd /c "set status=1"
    $(if $(status),@echo failed,@echo success)

This won't work. You cannot pass environment variables to the
parent shell, usually env is exported the opposite way. around.

Additionally, only relatively new versions of cmd --certainly not
DOS' support the "||" syntax.

AFAIK, make doesn't allow taking alternative pathes in case a program fails,
one can write complex scripts or batch files that make decisions. Makefiles
only work in one direction: build the given target.

reply via email to

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