-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabout.find.cmd
More file actions
43 lines (33 loc) · 1014 Bytes
/
about.find.cmd
File metadata and controls
43 lines (33 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@ECHO OFF
setlocal
:: Interpret arguments
IF "%~1"=="/?" GOTO :Usage
IF "%~1"=="-?" GOTO :Usage
IF "%~1"=="--help" GOTO :Usage
IF "x"=="x%~1" set filter=*.7z
IF NOT "x"=="x%~1" set filter=%~1
set about=%~dp0\about.cmd
:: Operate on matched files
for %%f in (%filter%) DO call :DoFindOrType "%%f" "%~2"
goto :EOF
:Usage
ECHO Usage:
ECHO about.find.cmd [FileFilter [substring]]
ECHO.
ECHO Examples:
ECHO about.find.cmd -shows .about.txt file for all archives
ECHO about.find.cmd "" "codename:" -find matching substrings in all archives
ECHO about.find.cmd *Cook*.7z -shows .about.txt file for matching archives
ECHO about.find.cmd *2016*.7z "Cumulative:" -find lines with "Cumulative:"
GOTO :EOF
:DoFindOrType
ECHO ------- %~1
IF "x%~2"=="x" GOTO :DoType "%~1" "%~2"
IF NOT "x%~2"=="x" GOTO :DoFind "%~1" "%~2"
GOTO :EOF
:DoFind
"%about%" "%~1" |Find /i "%~2"
goto :EOF
:DoType
call "%about%" "%~1"
goto :EOF