08.02.2022 Views

batch-file-es Windows

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Capítulo 26: Si declaraciones

Sintaxis

• if [/ i] StringToCompare1 == StringToCompare2 (commandA) else (commandB)

• si errorlevel 1 (commandA) else (commandB)

• si% errorlevel% == 1 (commandA) else (commandB)

• si existe Nombre de archivo (commandA) else (commandB)

• si se define VariableName (commandA) else (commandB)

Observaciones

Hay algunas sintaxis para elegir en una sentencia if . Usaremos if string1==string2 como

ejemplo.

Sintaxis de 1 línea

• if string1==string2 commandA

if string1==string2 (commandA)

• if string1==string2 (commandA) else (commandB)

• if string1==string2 (commandA) else commandB

• if string1==string2 (commandA)else (commandB)

• if string1==string2 (commandA)else commandB

Sintaxis multilínea

if string1==string2 (

commandA

)

O

if string1==string2 (

commandA

) else (

commandB

)

Todavía hay algunas sintaxis adicionales disponibles.

https://riptutorial.com/es/home 77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!