I am trying to work around a bug in an executable that does not return an error code, and I have to run it in a batch.
Using the following on cmd works (/n is to force an error):
"c:\program files\adobe\adobe after effects 2021\support files\aerender.exe" /n | find "ERROR" && exit 32
The problem is that I need to run in a batch with variable arguments, like so.
"c:\Program Files\Adobe\Adobe After Effects 2021\Support Files\aerender.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
obviously running
"c:\Program Files\Adobe\Adobe After Effects 2021\Support Files\aerender.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9 | find "ERROR" && exit 32
does not work. Is there a way to do this?
Sorry for the noob question Thanks for the help! Cheers!
CodePudding user response:
In case anyone stumbles on a similar problem, I've solved it like so:
"c:\Program Files\Adobe\Adobe After Effects 2021\Support Files\aerender.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9 > temp.txt
find /I "ERROR" temp.txt
if %errorlevel% equ 0 (exit 32) else (exit 0)
It writes the output to a temp file, then searches that temp file for the word ERROR, if it finds it exits with an error code.
There is probably a better way, but this worked for me Cheers