I would like to create a batch file to check if the file name has been written following certain rules. The file name contains some parameters (letters and numbers) splitted by an hyphen character like : FIN73-INV-2015-ANN
I would like to check the first two parameters (department name and document type) and above all check if the hypen has been written more than 1 time by mistake . e.g. FIN73--INV-2015-ANN
I have tried with the command FINDSTR but it seems that doesn't work because even if there are two hyphens the errorlevel is always 0 like in this case:
echo FIN73--INV-2015-ANN|FINDSTR /i "^[a-z]-[a-z]"
Do you have more suggestions ?
Thank you
Output example: