@ECHO OFF if "%1"=="help" goto help if "%1"=="/h" goto help if "%1"=="" goto default if "%2"=="" goto just1 fgrep /i %2 s:\diary\%1.dry goto end :just1 type s:\diary\%1.dry | more goto end :help ECHO diary [name] [[search_string]] ECHO diary - list contents of all diaries ECHO diary name - list content of specified diary ECHO diary name string - list all occurences of 'string' in named diary goto end :default for %%i in (s:\diary\*.dry) do more %%i :end