Dos - Logical Operator

Card Puncher Data Processing

About

Dos does not support logical operator but you can do:

  • a AND with nested if statement
  • a OR with an extra variable

Example

And

set month=13
if %month% geq 1 (
    if %month% leq 12 (
        echo Good Month
    ) else (
	echo Bad Month
    )
)

Or

set option=q
set res=0

:: Test les known options:
if "%option%"=="q" set optionKnown=True
if "%option%"=="l" set optionKnown=True

if "%optionKnown%"=="True" (
	echo Known Option: %option%
	) ELSE (
	echo Not Kwown Option: %option%
)

Documentation / Reference







Share this page:
Follow us:
Task Runner