Reputation: 1474
I was wondering how to check for a wildcard in a batch file
SET /p project=Enter project (XYZ_2016_123)
I need to be able to check if the variable project is in the format XYZ_20??_123 where ?? are two digits. Ignore the XYZ & 123 part of the input. At the moment I have lots of if statements to check if the year. But I was wondering if could be done with wildcards?
s=%project%
if not x%s:XYZ_2016_123=%==x%s% GOTO MAIN
if not x%s:XYZ_2017_123=%==x%s% GOTO MAIN
if not x%s:XYZ_2018_123=%==x%s% GOTO MAIN
:: etc.
Upvotes: 3
Views: 1507