DOS - (Control Operators | Command Separator)

1 - About

Dos supports the following control operator in order to control or separate command instruction.

For a linux shell, see Shell - Control Operators

3 - Cheatsheet

Operator Description
& all commands run serially without error checking
&& execute the next command only if the previous command is successful
|| execute the next command only executed only if the previous command has failed
() group commands

4 - List

4.1 - Ampersand

Text - Ampersand Character (&)

4.1.1 - Two Ampersand)

<wrap box>&&</note> The command following && is executed only if the first command is successful. This will work only with a command used before && that returns an exit code of 0 (zero).


echo 1 && echo 2

1
2

4.1.2 - One Ampersand

& error checking is not performed and all commands run serially.


badcommand 2>null & echo 1 & echo 2


1
2

where:

4.2 - OR

The OR control operator <wrap box>||</note>. The command following && is executed only if the first command has failed. This will work only with a command used before && that returns an exit code that is not `0' (zero).


echo 1 || echo 2

1

4.3 - ()

Group command


(echo 1 && echo 2)


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap