Do anyone knows if there is a Windows Batch-file equivalent to Unix Stop on Error "#!/bin/sh -e"?
There's really no good way to do what you want given the design of the shell in Windows (inherited from MS-DOS).
Generally speaking, CMD.EXE and COMMAND.COM blithely continue executing batch files even in the face of errors. Checking the
Errors in the syntax of constructs like
You'll never see
In general, error handling in the Windows shell is very non-sophisticated.
An arguable less bad way to stop an batch immediately on error is to use every "instruction" something like:
copy %UNEXISTING% C:\ || ( Echo Error file %UNEXISTING% does not exist & EXIT /B 1)
With || the rest the next command on the same line is executed only if the errorlevel from previous command is different from 0.