I am trying to search for a file on my drive containing
the text @1C
When not using quotes, I am getting the message The Index
Service Queary cannot be completed successfully because
the volume(s) you have specified are not indexed.
When using quotes, I get no results, yet I know a file
exists with the data.
Save the following as FindIt.bat, in a folder that is in your path:
@echo off
if {%3}=={} @echo Syntax: FindIt Path mask "String"&goto :EOF
if not exist %1 @echo Path Not Found: FindIt %1 %2 %3&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
set folder=%1
set mask=%2
set string=%3
if exist findit.log del /q findit.log
set fnd=N#*
call :quiet>>nul 2>>&1
endlocal
goto :EOF
:quiet
for /R %folder% %%a in (%mask%) do (
set file=%%a
for /f "Tokens=*" %%b in ('type "%%a"^|findstr /i /L /c:%string%') do (
if /i "!fnd!" NEQ "%%a" @echo %%a>>findit.log
set fnd=%%a
)
)
Open a CMD.EXE window.
Type
FindIt C:\ *.* "@1C"
where C:\ is the begining of your search and *.* is the mask. and the string,
@1C, must be quoted. If you knew it was in a text file, in the My Documents
folder, then:
FindIt "%UserProfile%\My Documents" *.txt "@1C"
The results are recorded in a FindIt.log file in the current folder of the CMD
window.
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com