It's all about the answers!

Ask a question

Exit status in a post command build


Fran Burgos (12312352) | asked Aug 13 '15, 4:05 a.m.
How can I get the return code in a post command build?

I have the following post commands in a build definition:

echo "Hello"
echo $?

But $? returns: ? and it should returns 0 because echo "Hello" finished OK. How can I get that status code or what other way exists for getting the status code from echo "Hello"?

Accepted answer


permanent link
Donald Nong (14.5k614) | answered Aug 14 '15, 1:58 a.m.
Have you tested the script separately? Are you running the script on Linux or Windows? The below commands work for me in a standalone script.
Linux:
echo "Hello"
echo $
Windows:
ECHO "Hello"
ECHO %ERRORLEVEL%
Fran Burgos selected this answer as the correct answer

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.