:ExtractSimple

extracts a marked section from batch file, sustitutes variables during extraction

Description: call:ExtractSimple StartMark EndMark
Script:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
:ExtractSimple StartMark EndMark -- extracts a marked section from batch file, sustitutes variables during extraction
::                               -- [IN]     StartMark - start mark
::                               -- [IN,OPT] EndMark   - optional end mark, default is first empty line
:$created 20091113 :$changed 20091113 :$categories FileOperation
:$source https://www.dostips.com
SETLOCAL
set "cpy="
for /f "tokens=1* delims=]" %%A in ('find /v /n "" "%~f0"') do (
    if "%%B"=="%~1" set "cpy=Y"
    if "%%B"=="%~2" set "cpy="
    if defined cpy call echo.%%B
)
EXIT /b