28 COMPACT CONDITIONAL EXECUTION

In this chapter, I’ll discuss conditional execution ... and no, this isn’t a chapter about the if command. It’s true that the if command is the quintessential example of executing code conditionally, and this chapter will revisit that discussion from Chapter 4, but with a very different take. Batch has a funky construct simply called conditional execution that executes one or more commands based on the success or failure of a prior command. It’s a compact and streamlined alternative to the if...else construct, but there are striking differences, and it’s crucial that you understand them before using it.

Get The Book of Batch Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.