Batch files return the error code of the last command by default.
Is it somehow possible to return the error code of a former command. Most notably, is it possible t
To call tee for entry bat-file, not for single command, and use errorlevel freely, I use trick like this:
if "%1" == "body" goto :body
call %0 body | tee log.txt
goto :eof
:body
set nls_lang=american_america
set HomePath=%~dp0
sqlplus "usr/pwd@tnsname" "@%HomePath%script.sql"
if errorlevel 1 goto dberror
rem Here I can do something which is dependent on correct finish of script.sql
:dberror
echo script.sqlerror failed
it separates using tee from calling any commands inside batch.