I have a sample.txt file with around 1000 strings and i have a main folder folder "adapt" which contains many files (files are also present inside many sub folders and file types are .xml, .cpp, .h and few more).
I need a batch script which will takes input as the sample.txt file (which is present in the same directory where batch script is) and either asks user to select the folder/ lets user modify the path of the folder in the code (folder is also present in the same directory as of batch file), and inside the folder&sub folders in all the file types, it has to search every string in the sample.txt file and if found write "found" in result.txt file/ if not found write "not found" in result.txt file.
Here are few strings in the text file
I found a script that prompts user for a string and gives the matches in another text file but i am having trouble in updating it. Here is what i found link.
The code I am trying to modify is below.
@echo off set OUTPUT_FILE="output.txt" set /p "var1=Enter the String to Find: " pushd %~p0 type NUL > %OUTPUT _FILE%.tmp for /f "delims=" %%a in ('dir /B /S *.txt') do ( for /f "tokens=3 delims=:" %%c in ('find /i /c "%var1%" "%%a"') do ( for /f "tokens=*" %%f in ('find /i "%var1%" "%%a"') do if %%c neq 0 echo %%f ) ) >> "%OUTPUT_FILE%".tmp move %OUTPUT_FILE%.tmp %OUTPUT_FILE% >nul 2>&1
Any help with the script please.