How to search for the exact match of string(s) using the windows findstr
command?
For example: I need to find only the exact match the string store
but not
stored
, storeday
, etc.
The below command returns all strings, store
, stored
and storeday
:
findstr /l /s /i /m /c:"store" "c:\test\*.txt"
Complete script:
set "manifest_folder=C:\Calc_scripts*.*"
set "file_list=C:\Search_results\Search_Input.txt"
set "outputfile=C:\Search_results\Search_results.txt"
(for /f "usebackq delims=" %%a in ("%file_list%") do (
set "found="
for /f "delims=" %%b in ('findstr /r /s /i /m /c:"%%a" "%manifest_folder%"') do (
echo %%a is found in %%~nxb
set "found=1"
)
if not defined found (
echo %%a is not found
)
))> "%outputFile%"