Search : in
By :

Batch script to search for a file in a folder

Last answer on Nov 2, 2008 11:55:40 am GMT KRISH, on Oct 18, 2008 8:02:01 am BST 
 Report this message to moderators

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....

Configuration: Windows XP

Best answers for « batch script to search for a file in a folder » in :
Batch Script - Move files to \%date%\%time%\ Show Batch Script - Move files to \%date%\%time%\ Issue Solution Note Issue I have been trying to make a simple batch script to create database backups and move then into a folder named by date, and a sub folder by time. This is what I...
VBA: How to know everything about the file folder ShowVBA: How to know everything about the file folder Preliminaries In module In sheet1 module Preliminaries Open a new workbook Add a module In module ' Declare variables for wizard. Public balloon1 As Balloon Public balloon2...
Cannot find script file [C:WINDOWSsowar.vbs] ShowCannot find script file "C:\WINDOWS\sowar.vbs" Issue Solution Issue Whenever I start my laptop I get: Cannot find script file "C:\WINDOWS\sowar.vbs". I think this is a virus. What should I do to resolve this one? Another thing,...
Renaming multiple files in batch ShowRenaming multiple files in batch Native features Using a third-party program Renaming a large number of files can quickly become tedious. Fortunately, there are tools to automate this task in many cases: Native features On Windows...
Download Find Junk Files ShowThe most part of applications on Windows create temporary files on your hard disk during their functioning. These files are assumed be abolished and the space recovered during the closing of program, but it is not always case. In the course of time,...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...
Operating Systems - MS-DOS - Commands ShowCommand Description dir lists the contents of a folder cd changes folder cd .. parent folder md or mkdir creates a new folder deltree deletes a folder and all sub-folders copy, xcopy copies...

1

JImc25, on Oct 28, 2008 2:29:44 pm GMT
  • +1

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\""

Reply to JImc25

2

 fuckingmoron, on Nov 2, 2008 11:55:40 am GMT
  • +4

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...

Reply to fuckingmoron