Re: ERRORLEVEL by texify

David Allsopp <[email protected]>
Newsgroups gmane.comp.tex.miktex
Organization MetaStack Solutions Ltd.
Message-ID <[email protected]>
Daniele Giorgio Degiorgi wrote:
> Hi,
> 
> I try to use following cmd file to generate a full recompilation
> 
> rem @echo off
> rem %1 directory, %2 tex name, %3 dir name
> cd K:/_BookList/Years/%1
> texify --pdf  %2.tex <F:\texinp.txt >texify.log
> if NOT ERRORLEVEL 0 goto lab1
> MOVE %2.pdf M:\_Library\%3
> goto lab2
> :lab1
> echo %1/%2 failed
> :lab2
> 
> Where the file F:\texinp.txt just contains an x to quit.
> 
> If texify succeed, the generated pdf will be moved, but if it does not
> succeed, it still returns errorlevel 0, while writing
> Sorry, but texify did not succeed.

I don't use texify (I personally prefer to write Makefiles, rather than relying on magic commands), but I think you don't understand how errorlevel works - it is cumulative. If texify returns exit *code* 1, then you will have errorlevel 1 and errorlevel 0. If you want to use the actual exit code, you need to use %ERRORLEVEL% which is a number, e.g.

if %errorlevel% equ 1 goto lab1

Though I have no idea if texify actually sets exit codes on error (you can tell this by using echo %ERRORLEVEL%).

HTH,


David

------------------------------------------------------------------------------
_______________________________________________
Q: How can I leave the mailing list?
A: See http://docs.miktex.org/faq/support.html#leavingml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.