CODE: [Copy to clipboard]
@echo off
:: main entry
set "func=%~1"
shift
goto %func%
goto:EOF
:: functions definitions show below
:bannerPingPong varref -- moves text in varref one step left or right and updates title
:: -- varref [in,out] - variable name with banner text, format: "Banner Text------"
SETLOCAL ENABLEDELAYEDEXPANSION
set s=!%~1: =-!
if "!s:~-1!" NEQ "-" if "!s:~-1!" NEQ "+" set s=!s!--------
set d=!s:~-1!
if "!s:~0,1!" NEQ "-" set d=+
if "!s:~-2,1!" NEQ "-" set d=-
if "!d!"=="+" (set s=-!s:~0,-2!+) ELSE (set s=!s:~1,-1!--)
TITLE !s!
(ENDLOCAL & REM RETURN VALUES
IF "%~1" NEQ "" SET %~1=%s%
)
goto:EOF
app.bat: