The script I need:
Search through the current directory and subfolders for specified name.
I don't want to specify the name within the script. I want to specify it after the script is running.
What I got so far:
echo Type your filename to search
echo .-=========================-.
SET Fileput=
SET /P Fileput=Filename:
IF /I '%Fileput%'=='1' GOTO Search
:search
For each "tokens=*" %%I in ('cd% /s /b') do set filefound="%%~fI"
echo %FILEFOUND% >> "C:\temp\%date%_search_result_%random%.txt"
I'm pretty sure the issue is at "IF /I '%Fileput%'=='1' GOTO Search" because thats not what I want. I want the text I type in to be the input to search for. Or perhaps its another way to SET the input... Thanks!
for eachloop in command prompt or batch scripts (I guess you meanfor /F); you can enumerate a directory tree byfor /D; however, to search for a certain file, you can usedir /S %Fileput%check%ErrorLevel%which is1if not found and0otherwise...dir /b /s %Fileput%>result.txt?