We previously explained how to use 'IF this OR that' in a batch.
Here is an additional method that makes use of the built-in FINDSTR command:
Example:
To determine of a parameter is equal to Jennifer or Richard or Jerry or Alisa
call :isequal Richard goto :EOF :isequal @echo \[Jennifer\] \[Richard\] \[Jerry\] \[Alisa\] | findstr /c:"\[%1\]" >nul if %errorlevel% equ 0 ( @echo %1 found. ) ELSE ( @echo %1 NOT found. )NOTE: This routine is case sensitive. If you wish to make it case insensitive, replace findstr /c:"\[%1\]" with findstr /i /c:"\[%1\]"
0 comments
Hide comments