Hi Everyone,
I have file (filename.txt) which contains
ProductABC_Test.txt
ProductDEF_Test.txt
ProductHIG_Test.txt
ProductIJK_Test.txt
I will be getting a variable passed (ex: product=ABC which will be substring of ProductABC_Test.txt). So I need to fetch the correct test name (ProductABC_Test.txt) from the filename.txt.
I have tried like below -
SETLOCAL ENABLEEXTENSIONS
::@echo off
set product=ABC
SETLOCAL EnableDelayedExpansion
for /F "tokens=*" %%A in (filenames.txt) do (
Set str=%%A
echo %str%
if NOT %str%==!%str:product=% (
set test_suite=!test_suite! %%A
)else (
echo
)
)
ENDLOCAL
echo %test_suite%
But I am not getting the right result. Please help.
help me with dos find string using substring
Moderator: DosItHelp