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

- - Latest reply:  batchdude - Nov 26, 2011 at 11:46 AM
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....
See more 

2 replies

Best answer
15
Thank you
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...

Say "Thank you" 15

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

CCM 5629 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?
7
Thank you
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\""