If-then-else statement in a batch file

J

joe vaughan

I'm running a batch file to unzip some pdf files, and print them. I don't
want the program to run if there isn't a zip file available. I'm trying to
run the following which only gives me a syntax error.

IF not EXIST
"P:\Pyrwin\Reports\shormans\Shorman_eob_print_jobs\processing\working\*.zip"
GOTO END

This isn't working. Any ideas?
 
P

Pegasus \(MVP\)

joe vaughan said:
I'm running a batch file to unzip some pdf files, and print them. I don't
want the program to run if there isn't a zip file available. I'm trying
to
run the following which only gives me a syntax error.

IF not EXIST
"P:\Pyrwin\Reports\shormans\Shorman_eob_print_jobs\processing\working\*.zip"
GOTO END

This isn't working. Any ideas?

If you put this all on one single line then it will work:
if not exist "P:\Pyr...\*.zip" goto :eof
Note the inbuilt :eof label, preceded by a colon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top