批处理文件 - 此时"输入"出乎意料



这是我期望它能完美运行的代码:

@echo off
echo.BASIC LANGUAGE COMPILER
:start
set available=0
set /p input="> "
for /F %%a in ("%input%") do set mainline=%%a
findstr /ri /c:"^ *:%mainline% " /c:"^ *:%input%$" "%~f0" >nul 2>nul && set available=1
echo available : %available%
if %available%==1 (call :%input%) else (echo ERROR 001 : UNAVAILABLE LINE)
set input=
set available=
goto :start
:echo
echo %1 %2 %3
goto :start
:cls
cls
goto :start

但是不管我做了什么,它只是回显:

错误001:Unavailable line.

即使我输入echo hi hi hi hi
我能做什么?问题在哪里?

/c:"^ *:%mainline% "

标签末尾可以有空格,也可以没有

.... /c:"^ *:%mainline% " /c:"^ *:%mainline%$" ....

最新更新