REM String Length Calculator
REM Replace "str" value with the required string
REM (don't forget commas for strings with spaces)
@ECHO OFF
setlocal enabledelayedexpansion
set str1="Some string to be calculated"
call :Len !str1!
echo !Len!
Pause
goto :Eof
:Len
set Str=%1
set Len=0
:Loop
if "!Str!"=="" goto :Eof
set /a Len=!Len!+1
set Str=!Str:~1!
goto Loop 