Batch script to search for a file in a folder [Closed]

Report
-
 batchdude -
Hello,
I want a batch script which finds for a filename(say "setup.lst" ) in all subfolders and print the folder name in which the file contains. Can anybody help me? its urgent.
Advance Thanks....

2 replies

well I have something defrent , I wanted to do the same thing I think ,
that's my batch :

@echo off
set pth=%*
cd %pth%
title Searching in %pth% and all sub directories .
:begin
set LF=
cls
echo ToExit - Don't Search [Hit ENTER]
set /p LF=Looking For :
if x%LF%==x goto eof
dir /s %LF%
echo.
echo Done.
pause>nul
goto begin
:eof
cls
echo Thank You .
pause>nul

and add to the registry : [HKEY_CLASSES_ROOT\Folder\shell\Search bat\command]
@="\"C:\\Program Files\\Search\\search.bat\" %1"

that's what I have , I use it all the time...
15
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 4094 users have said thank you to us this month

If I want to modify the batch to look for a certain file EVERY time I click it?
try this bat file

@echo off
dir %1 /b /o:gn > "%temp%\Listing"
start /w excel "%temp%\Listing"
del "%temp%\Listing"
exit


It prints to an excel file. Add it to the registry (*.reg) to to opo up on the right click menu

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Print File Name]

[HKEY_CLASSES_ROOT\Directory\shell\Print File Name\command]
@="printdir2.bat \"%1\""