Performs conditional processing in batch scripts. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/if.
if {{condition}} ({{echo Condition is true}})
if not {{condition}} ({{echo Condition is true}})
if {{condition}} ({{echo Condition is true}}) else ({{echo Condition is false}})
%errorlevel%
is greater than or equal to the specified exit code:if errorlevel {{2}} ({{echo Condition is true}})
if %{{variable}}% == {{string}} ({{echo Condition is true}})
if /i %{{variable}}% == {{string}} ({{echo Condition is true}})
if exist {{path\to\file}} ({{echo Condition is true}})