If Command In Windows Server 2008
In this article I am going to explain about IF Command in Windows Server 2008 operating system and also explain it's related syntax.
If command applies to all versions of Windows. If command conditionally performs a command in batch program. If the condition is true then the command specified in if clause is carried out. If the condition is false then the command specified in else clause is carried out and command in the if clause is ignored.
if [not] ERRORLEVEL <Number> <Command> [else <Expression>]
if [not] <String1>==<String2> <Command> [else <Expression>]
if [not] exist <FileName> <Command> [else <Expression>]
Error check syntax
if [/i] <String1> <CompareOp> <String2> <Command> [else <Expression>]
if cmdextversion <Number> <Command> [else <Expression>]
if defined <Variable> <Command> [else <Expression>]
||The command to perform if the condition is met.
||Perform the command, only if the condition is false.
||Specifies condition will be true only if last program run by command shell returned an exit code >= number.
||Performs the command only if String1 and String2 are the same.
||True condition if the given file name exists.
||May be one of: following three letter comparison operator:
EQU Equal to
NEQ Not equal
LSS : Less than <
LEQ Less than or equal to
GTR Greater than >
GEQ Greater than or equal to
||Forces string comparisons to ignore case.
||True condition only if the internal version number associated with the command extensions feature is >= number..
||Denotes a true condition if variable is defined.
||The command to perform specified in else clause.
IF EXIST C:\department (echo complete) ELSE (echo failed)
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here