I try to create bat file to iterate throuth only files in directory which file names begin with specific word.
For Example:
companyName.module1.exe
companyName.module2.dll
I know how to iterate files but don’t know how to check their names for specific condition.
Add the following to your batch file:
This script will
echoall files (files only) that begin with companyName prefix in the current working directory. Replaceechowith any other command or commands that you want to perform instead.Update 1: In order to look in a different directory you can either
or
Where pathToLookIn is a fully qualified or relative path.
Update 2: I’ve updated the
for /Floop to handle file names that begin with;as @dbenham suggested.