I'm trying to make a bat file that localizes labels in a custom extension file I made and gets an output, the problem is that since there is apparently no way to increase a variable in a FOR loop without starting a local environment, I cannot do that.
@echo off
SET _TSL=%3
SET _forcount=1
SET _COLONLINE=0
SET /a _LINESKIP=%_TSL%-1
if "%5"=="1" (
echo [Mesa Markdown Debug] File Directory : %1
echo [Mesa Markdown Debug] Target Colon : %2
echo [Mesa Markdown Debug] Line : %_LINESKIP%
echo [Mesa Markdown Debug] Item : %4
echo [Mesa Markdown Debug] DebugMode : %5
echo.
)
setlocal ENABLEDELAYEDEXPANSION
for /F "eol=$ usebackq" %%i in (%1) do (
SET /A _forcount=_forcount+1
if "%%i"=="%2" SET _COLONLINE=!_forcount!
)
if "%5"=="1" (echo [Mesa Markdown Debug] Target Colon is: %_COLONLINE%)
SET /a _LINESKIP=%_LINESKIP%+%_COLONLINE%
if "%5"=="1" (echo [Mesa Markdown Debug] Target line acquired: %_LINESKIP%)
for /F "eol=$ skip=%_LINESKIP% delims=" %%i in (%1) do if not defined _mmkstring (SET _mmkstring=%%i)
if "%5"=="1" (echo [Mesa Markd
own Debug] Conent of line %_LINESKIP%: %_mmkstring%)
if "%_mmkstring%"=="" (echo [Mesa Markdown] Error @ line %_LINESKIP% of %1 - The line appears empty.)
if "%4"=="1" (for /F "tokens=1-9* delims={}," %%a in ("%_mmkstring%") do SET _mmk=%%a)
if "%4"=="2" (for /F "tokens=1-9* delims={}," %%a in ("%_mmkstring%") do SET _mmk=%%c)
if "%4"=="3" (for /F "tokens=1-9* delims={}," %%a in ("%_mmkstring%") do SET _mmk=%%e)
endlocal
In a separate batch file which called this one, "echo %_mmk% returns nothing.