string manipulation help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
ice_531
Posts: 18
Joined: 21 Jan 2011 09:59

Re: string manipulation help

#31 Post by ice_531 » 01 Feb 2011 17:50

Code: Select all

:SEARCH

set /p buildPatch=Enter the build and patch level:
set /p choice=Enter the search word or phrase to find the QF:

dir /ad /b | findstr /i /c:"%buildPatch%" > "%myPath%\temp.txt"

set myTemp="%myPath%temp.txt"

explorer %CD%

setLocal EnableDelayedExpansion
for /f "tokens=1* delims= usebackq" %%a in (%myTemp%) do (
set /a n+=1
set v!n!=%%a

pushD %CD%\%%a\
for /f "tokens=* delims= " %%b in ('FINDSTR /s /i /L /M /c:"%choice%" *.txt') do (

echo %%a

 
)
popD
)

popD
set /p exit= Do you want to try to search again: y for yes, n for no.
IF %exit%==y (
CLS
GOTO MAIN
)


IF %exit%==n exit


Heres the finished code from just part of the script, the actual search function. I had to make 2 different ones though, due to the weird folder structure.

Post Reply