Last active
August 1, 2018 18:26
-
-
Save 1ijack/52383383af6abc7aba47e98bce1a93e8 to your computer and use it in GitHub Desktop.
print all labels script -- [batch function call label]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: by JaCk | Release 08/01/2018 | https://gist.github.com/1ijack/52383383af6abc7aba47e98bce1a93e8 | dump_batch_labels.bat -- A Quick Example script using an internal function to dump all the scripts call/goto labels | |
@if exist "%~f0" call :dump_batch_labels "%~f0" | |
@goto :eof | |
:: Usage :: dump_batch_labels "path\myBatchfile.cmd" "D:\path\myBatchfile.bat" | |
@rem Displays all call/goto/function labels found in a [batch] file except self-function-name OR manually excluded in function below | |
:dump_batch_labels | |
@if "%~1" equ "" goto :eof | |
@( dir /b /a %1 ) 2>nul 1>nul && @for /f "tokens=1*" %%A in ('%SystemRoot%\System32\findstr.exe /rv "\<[:]exclusionFilter\> \<\%~0\> \<findstr\> \<rem\> \<[:][:]\>" "%~1" ') do @echo/%%A|"%SystemRoot%\System32\findstr.exe" /ri "^:[^:].*\> \<.[^::]:" | |
@shift /1 &@goto %~0 | |
:A_Label | |
@echo/Do A Big things | |
@goto :eof | |
:A_BLabel | |
@echo/Do BBigger things | |
@goto :eof | |
:A_B_ETC_Label | |
@echo/Designated Procrastination Section | |
@goto :eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment