Hi
i want batch file which will work like windows search
when i run the batch file
1.it will prompt for path
2. then search string (eg. sample workbook.xls) i will enter string sample
3.it will search for string on that path & save the results in excel file, mean ">" divert the results to excel file in same folder
4. excel file will contain all the results of search, it should contain path of file which is found
eg. c:\temp\sample.xls
c:\temp\temp2\sample workbook.xls
5.if not found then excel file results will be not found
i will appreciate any help on this.
Batch file to find file in folder & subfolders
Moderator: DosItHelp
Re: Batch file to find file in folder & subfolders
try this
Code: Select all
@echo off
dir /s /b > source
set /p "str2find=Search for: "
findstr /s /i "%str2find" source && findstr /i "%str2find" source >> results.csv || echo file not found >> results.csv
del /f /q source
exit /b
Re: Batch file to find file in folder & subfolders
Thank u so much Renzlo !
this batch do execute, but when i enter search criteria i always get results as file not found
in excel file
wheni click on batch file where it exactly search ? when i open cmd prompt it default set as C:\>
but i want to search file in F:\> drive
how to provide path in this batch file.
i will appreciate any help on this
Again thanks for reply
this batch do execute, but when i enter search criteria i always get results as file not found
in excel file
wheni click on batch file where it exactly search ? when i open cmd prompt it default set as C:\>
but i want to search file in F:\> drive
how to provide path in this batch file.
i will appreciate any help on this
Again thanks for reply