# Findstr and else



## zetori (Oct 6, 2011)

Hi

I'm trying to write batch file that could find a user given word from user given directory\file. If founded, calls a second batch.

I quite new and don't have much clue what to do with this, but something like this:


```
set /p findwhat = Type word: 
set /p findwhere = Type where to find: 
for /F "tokens=1,2,3,* delims=;" %%i IN ('findstr /i "%findwhat%" %findwhere%')
IF EXIST (call batch1.bat) ELSE ECHO not found at %findwhere%
exit
```
Could you help me with this one, please

Thank you


----------



## jat421 (Jun 14, 2008)

I would rather do something simple like


```
@echo off
set /p findwhat= Type word: %=%
set /p findwhere= Type where to find: %=%

PUSHD %findwhere%
Findstr /s /m "%findwhat%" *.*
IF %ERRORLEVEL% EQU 0 (echo found) ELSE (echo not found)
POPD
```


----------

