Differences between revisions 1 and 2
Revision 1 as of 2023-01-30 02:47:46
Size: 137
Comment:
Revision 2 as of 2023-01-30 03:11:37
Size: 489
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
----



== Conditional Commands ==

To execute a command conditionally after another command, try:

{{{
del example.txt && echo "This only executes because the first command set an exit code of 0"

del example.txt || echo "This only executes because the first command set an exit code of 1"
}}}

These operators have equal precedence.

Batch Logic


If

IF "%foo%"=="bar" ECHO Equal


Conditional Commands

To execute a command conditionally after another command, try:

del example.txt && echo "This only executes because the first command set an exit code of 0"

del example.txt || echo "This only executes because the first command set an exit code of 1"

These operators have equal precedence.


CategoryRicottone

Batch/Logic (last edited 2023-01-30 03:11:37 by DominicRicottone)