If

Supports conditional logic in scripts.

Syntax

 if [not] errorlevel number command [else expression] if [not] string1==string2 command [else expression] if [not] exist filename command [else expression] if [/i] string1 compare-op string2 command [else expression] if cmdextversion number command [else expression] if defined variable command [else expression] 

Parameters

 

Parameter

Purpose


[not]

Reverses the test condition.

errorlevel number

Sets a true condition if the previous program returned an exit code equal to or greater than number.

command

Identifies a command that the shell is to execute if the preceding condition is satisfied.

string1==string2

Specifies a true condition when string1 and string2 are the same.

exist filename

Specifies a true condition when a filename exists.

compare-op

Can be any of the following operators:

EQU

equal to

NEQ

not equal to

LSS

less than

LEQ

less than or equal to

GTR

greater than

GEQ

greater than or equal to

[/i]

Forces case-insensitive string comparisons.

cmdextversion number

Compares the internal version number associated with CMD.EXE to the specified number.

defined variable

Returns true if the environment variable is defined.

[else expression]

Specifies the command and any parameters that need to be passed to the command.



Microsoft Windows XP Professional Administrator's Guide
Microsoft Windows XP Professional Administrators Guide
ISBN: 1931841969
EAN: 2147483647
Year: 2005
Pages: 358

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net