0

我正在尝试制作一个 bat 文件,将我制作的自定义扩展文件中的标签本地化并获取输出,问题是由于显然没有办法在不启动本地环境的情况下增加 FOR 循环中的变量,我不能去做。

@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

在一个名为这个的单独批处理文件中,“echo %_mmk% 什么也不返回。

4

0 回答 0