Link to home
Start Free TrialLog in
Avatar of tangerine27
tangerine27

asked on

Wildcard with IF EXIST doesn't work

Hi,
I want to get a batch file to continue if .txt files exist in the specified directory.
I tried this:

IF EXIST c:\test\*.txt GOTO END
<rest if batch file>
:END

But this ran all the commands without .txt files.

Please could someone tell me how to do this?

Cheers,
ASKER CERTIFIED SOLUTION
Avatar of 97WideGlide
97WideGlide

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 97WideGlide
97WideGlide

UR syntax looks okay to me

what happens if you try?

if exist c:\test\*.txt dir c:\test\*.txt
Avatar of Michael Pfister
IF NOT EXIST c:\test\*.txt GOTO :END
<rest if batch file>
:END
tangerine27, any news?