Page 1 of 1

How to get %errorlevel% or error code of run() or runret()?

Posted: 28 May 2016 23:15
by pulp
hi,

do somebody know how to get the %errorlevel% env variable after executing run() or runset()?

I tried

text runret("cmd /c ""git pull >nul 2>&1 & echo %errorlevel%""");
git pull in this case will fail and i want to detect the failure.

but this returns 0 instead of 1. executing the command in a cmd window the command only returns 1 on the first run.

thanks pulp