Home >> MS-DOS Reference >> Command Categories >> Batch File Commands >> IF
|
|
Batch File Commands |
|
|
IF something_is_true do_something
or
IF NOT something_is_true do_something
Using NOT in this way allows you to check the reverse of something. If, for example, you wanted to check if a file did not exist you could do it like this:
IF NOT EXIST filename do_something
IF something GOTO Next
REM The "ELSE" statements could be inserted here
GOTO End
:Next
REM Do whatever should happen if something is true.
:End
| Home | |
| MS-DOS Home | |
| A - Z Index |
| Top of page |
| Summary |
| Description |
| Command Syntax |
| Comments |
|
|
Printed from the NukeSoft MS-DOS Reference. Copyright © 1995 - 2006 Marcus Houlden