::::::::::::::::::::::::::::::::::::::::::: ::: string_length.bat Special Function ::: ::::::::::::::::::::::::::::::::::::::::::: ::: An extremely cool function found on ::: ::: StackExchange and I wish I'd gotten ::: ::: the contributors name and followed. ::: ::: Split out from runtime_display.bat ::: ::: v7.9.8.92 20221125101121 by -JpE- ::: ::::::::::::::::::::::::::::::::::::::::::: ::: RC5 ::: Special Function Finds String Length :strlen ( setlocal EnableDelayedExpansion set "s=!%~2!#" set "len=0" for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do ( if "!s:~%%P,1!" NEQ "" ( set /a "len+=%%P" set "s=!s:~%%P!" ) ) ) ( endlocal set "%~1=%len%" exit /b %ERRORLEVEL% )