L
loial
Is there a command I can use to test whether a file exists, e.g,
equivelent to the unix "test" command?
equivelent to the unix "test" command?
Bob I said:Yes, the "If" command
If Performs conditional processing in batch programs.
Syntax
if [not] errorlevel number command [else expression]
if [not] string1==string2 command [else expression]
if [not] exist FileName command [else expression]
If command extensions are enabled, use the following syntax:
if [/i] string1 CompareOp string2 command [else expression]
if cmdextversion number command [else expression]
if defined variable command [else expression]
Is there a command I can use to test whether a file exists, e.g,
equivelent to the unix "test" command?
This needs some syntax adjustment. The line
if [not] errorlevel number command [else expression]
won't work whereas this line will:
if [not] errorlevel number (command) [else (expression)]
In other words, the ellipses are compulsory when using "else".
Type if /? at the Command Prompt for the full syntax. It says
there specifically:
=================
The following would NOT work because the del command
needs to be terminated by a newline:
IF EXIST filename. del filename. ELSE echo filename. missing
=================
Yes, the "If" command
If Performs conditional processing in batch programs.
Syntax
if [not] errorlevel number command [else expression]
if [not] string1==string2 command [else expression]
if [not] exist FileName command [else expression]
If command extensions are enabled, use the following syntax:
if [/i] string1 CompareOp string2 command [else expression]
if cmdextversion number command [else expression]
if defined variable command [else expression]
loial wrote:
Is there a command I can use to test whether a file exists, e.g,
equivelent to the unix "test" command?