home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 40,816 of 42,547   
   Tim Meddick to All   
   Re: How to displaying error on console w   
   06 Dec 13 10:17:31   
   
   From: timmeddick@o2.co.uk   
      
   Hi, depending how experienced you are with batch-file programming, and also   
   depending exactly what it is you are trying to accomplish - it may be a   
   possible solution is the [exit] command...!!   
        Use the [exit] command (cmd.exe - only) together with the [/b] switch   
   (Type [exit /?] at the prompt for explanation and use of;)  will allow you   
   to specify your own ERRORLEVEL at the point of exit - a short example to   
   illustrate the principle is reproduced here....   
      
      
   @echo off   
   if EXIST x:\mypath\myfile.ext goto SUCCESS   
   goto FAILED   
      
   :SUCCESS   
   echo  - MyFile is Present -   
   wscript.exe SUCCESS.VBS   
   exit /b 0   
      
   :FAILED   
   echo  - MyFile is Absent -   
   wscript.exe FAILED.VBS   
   exit /b 1   
      
      
   However, if it is also part of your query to make some sort of "alert"   
   appear on the desktop to indicate failure, then you could [also] call a   
   simple customised VBScript-file from the batch-file - an example is   
   reproduced below....   
      
      
   'FAILED.VBS   
   'For use with batch files   
   strTitle="BATCHFILE ERROR"   
   Dim WSHShell   
   Set WSHShell = WScript.CreateObject("WScript.Shell")   
   WSHShell.Popup "A specified failure has occurred!" , 5, strTitle   
      
      
    ...obviously, you would also need to create the SUCCESS.VBS file, using   
   the file above to guide you - altering the text for the title and the   
   nature of the message displayed....   
      
   ==   
      
   Cheers,    Tim Meddick,    Peckham, London.    :-)   
      
      
      
      
    wrote in message   
   news:0f4c6f2f-4b2f-4071-a842-6698e73c04b5@googlegroups.com...   
   Hello!   
   I am new to batch file.Simply using batch files to run a set of LaTeX   
   commands for rendering LaTeX input.   
      
   Here is the batch file:   
      
   latex 1.tex   
   dvipng -T tight 1.dvi   
   copy 11.png question-preview   
      
   What happens is: when correct LaTeX input is given, batch file complete its   
   execution successfully and desired output is generated. But when a wrong   
   input is given, usually the first command (latex 1.tex) remained unable to   
   produce the desired output but no error is displayed on the console. In   
   this case I want to see the error generated by the Tex Engine (that was   
   actually behind the scene running that command) on the console.   
      
   I want something   
   if(Command goes fine)   
   no pause   
    else   
   console should take a pause and error should be displayed on the screen.   
      
   Can someone help me tacking this issue?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca