I am writing a batch file wherein I have read the filenames of all the files in a directory and then look for a particular string in the filenames. I am able to get the filenames but unable to find a way to search for a particular string in the filename.
e.g. Name of the file is abc_account_march_2010.csv. I have to check if the filename contains the word "account" in it or not if it does then rename the file.
this is what I have done to get the file name.
FOR /R %completepath% %%G IN (*.csv) DO (
echo %%~nG
)
%completepath% - is the path to my directory/folder.
Thanks.