|
Answer» Hi. I'm trying to issue a "pause" whenever my compiler echos back an error it FOUND in one of my files. The ":Compile" section below is where I'm having difficulty.
:Begin for %%f in (*.prg) do (call :Compile "%%f") goto End
:Compile // The following is pseudo-code of what I'd like it to do: if "Error" is in (Compile.exe %1) do ( Echo Error Discovered! pause ) goto :eof
:End
Thanks. Not all programs USE return codes as indicators or success or failure. This may work for you:
Code: [Select]:Begin for %%f in (*.prg) do (call :Compile "%%f") goto End
:Compile // The following is pseudo-code of what I'd like it to do: Compile.exe %1 if errorlevel 1 (Echo Error Discovered!) else (echo No Error Discovered!) pause ) goto :eof
:End
Hope this helps!
PS. If your compiler outputs a log file indicating success or failure, you could use the find command after the compiler runs. Just a thought.Hi Sidwinder. Thanks for the response. Unfortunately my compiler doesn't return any errorlevels. It doesn't create a log either, but I could REDIRECT the output to a file of course, then do a find. I would have to display the error to the screen after though. Seems COMPLEX.
SOMETHING like:
:Compile Compile.exe %1 > errorlog.txt // pseudo-code: If "Error" is inside errorlog.txt then Echo contents of errorlog.txt Else do nothing
It needn't be complex. If you direct the output to a file, you can use find to look for a string that indicates success. If the errorlevel from the find is zero the compile succeeded. If it's not zero it failed.
I guessing there is something in the output that indicates success or failure.
Thanks again. I have it working.
|