findstr /i /r /c:"^[ ]*:%input%\>" "%~f0" >nul 2>nul && goto %input%
Find the label in the current batch file, and if there is no error level, there is a label
EDITED - I realized that there was a mistake in the way I handled the end of the shortcut and was going to edit the answer (it was edited anyway), and I see dbenham aquariums. He saw a mistake and corrected it. Thank. A good answer, as always, BUT this is worse than you showed.
At this point, I only have XP to test, but this is what works for me. If someone can test later versions of Windows, please.
: . , dbenham , [;=,<space><tab>0xFF] , , . , , , ( ). , .
call :test
goto :test
echo this will not be echoed
X=;=:test
echo Hello
, , , " ", - .
: . dbenham, , /. , . , (, , ) . ,
:test arguments
:test:arguments
:test>arguments
:test<arguments
:test&arguments
,
, , ""
call :test
goto :test
echo this will not be echoed
< ;;:test:;; > This WORKS
echo Hello
POST EDIT 1 - , dostips.com. , exaustive, . .
POST EDIT 2 - findstr, . , . , 0xff .
dbenham.
, STILL INCOMPLETE, , dbenham
@echo off
for /l %%i in (1 1 10) do (
call :testLabelExist "test%%i" && echo Label [test%%i] exist || echo Label [test%%i] does not exist
)
exit /b
:test1
:test2
:test3
x:test4
::test5
:test6:
:test7
:test8 parameters
:test9 parameters
:test10:myData
:testLabelExist
for /f "delims=" %%t in (
'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /d /c @echo 0x09"'
) do (
findstr /i /m /r /c:"^[^:]*[ %%t]*:%~1[ %%t:;,=+]" /c:"^[^:]*[ %%t]*:%~1$" "%~f0" >nul 2>nul
)
exit /b %errorlevel%
- , .