Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window shell script return codes

Tags:

shell

windows

Is there a standard set of return code for Window shell scripts (*.bat files)? I'm looking for something analogous to Linux exit codes, where 0==success and non-zero==failure. I need a way to programmatically check if my shell script failed during execution.

like image 835
theactiveactor Avatar asked Jun 07 '26 18:06

theactiveactor


1 Answers

The most common practive is the sames as the Unix standard, so a return code (also called errorlevel in batch files) of 0 is success, whereas anything higher than 0 is an error.

There are a number of related gotchas to look for though - have a look at this guide:

Batch Files - Errorlevels

like image 159
Colin Pickard Avatar answered Jun 09 '26 08:06

Colin Pickard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!