EasyManua.ls Logo

Commodore PC - Page 185

Commodore PC
414 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Batch
Processing
113
|
n
[\
'
'
if
Purpose:
Performs
a
command
based
on
the
result
of
a
condition.
Syntax:
if
[NOT]
error
level
number
command
or
if
[NOT]
stringl
=
=
string2
command
or
if
[NOT]
exist
filename
command
Comments:
The
if
statement
allows
conditional
execution
of
commands.
When
the
condition
is
true,
ms-dos
executes
the
command,
other
wise
it
ignores the
command.
The
conditions
are
described
as
follows:
errorlevel
number
True
if,
and
only
if,
the
previous
program
executed
by
command.com
had
an
exit
code
of
number
or
higher.
(When
a
program
finishes,
it
returns
an
exit
code
via
ms-dos.)
You
can
use
this
condition
to
perform
other
tasks
that
are
based
on
the
previ
ous
program's
exit
code.
stringl
= =
string2
True
if,
and
only
if,
stringl
and
string2
are
identical
after
parame
ter
substitution.
Strings
may
not
contain
separators,
such
as
com
mas,
semicolons,
equal
signs,
or
spaces.
exist
filename
True
if,
and
only
if,
filename
exists.
If
you
specify
the
NOT
parameter,
ms-dos
executes
the
command
when
the
condition
is
false.
Example:
The
following
example
prints
the
message
"can't
find
datafile"
if
the
file
productdat
does
not
exist
on
the
disk:
if
i
Displaying
a
conditional
message
if
not
exist
product.dat
echo
can't
find
datafile

Related product manuals