1

I have these two lines in my batch script:

call pre.bat
call post.bat

And I have a exit condition in pre.bat (i.e. exit 255)

How can I execute post.bat even if pre.bat exits with an error code?

1 Answer 1

6

Use exit /b 255 instead of exit 255 in your pre.bat

If you cannot change pre.bat, then you can use start /b /wait pre.bat instead of call pre.bat. But then all changes to environment variables that pre.bat might have made will be lost.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer! Is there a way to achieve this without changing pre.bat?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.