The following version of Dr.Batcher, which is going to be released in a few days, will bring support for extended syntax of 'If' command. So we decided to give you some additional information on using 'Else' in batch file conditions.
The command after 'Else' keyword will be executed if the condition appears to be false. You should know that the whole 'If' statement must be written in the same line, so you cannot write your batch file in the following manner:
If errorlevel 1 Echo Error!
Else Echo Everything's OK!
But the following code will work perfectly:
If errorlevel 1 (
Echo Error!
) Else (
Echo Everything's OK!
)
Note that you can add extra commands between brackets and thus compose quite complex scripts.
Monday, November 23, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment