Why in Batch/DOS (or whatsoever language), "To avoid this pitfall force CommandBlock2 to succeed, i.e. using a simple REM as last block command: Command1 && (CommandBlock2 & REM) || (CommandBlock3) " could work? My question is why adding a remark would change the conditional execution?
npocmaka has given the answer already.
DOS Tips article about Conditional Execution explains:
Be careful when combining the operators, i.e.:
Command1 && (CommandBlock2) || (CommandBlock3)
- If Command1 fails then CommandBlock2 will be skipped and CommandBlock3 will be executed.
- If Command1 succeeds then CommandBlock2 will be executed.
- If Command2 fails then CommandBlock3 will also be executed!!
To avoid this pitfall force CommandBlock2 to succeed, i.e. using a simple REM as last block command:
Command1 && (CommandBlock2 & REM) || (CommandBlock3)
or:
Command1 && (
CommandBlock2
REM force success
) || (
CommandBlock3
)