rem compute the length of a string
set #=%myvar%
set length=0
:loop
if defined # (
rem shorten string by one character
set #=%#:~1%
rem increment the string count variable %length%
set /A length += 1
rem repeat until string is null
goto loop
)
echo myvar is %length% characters long!
Thanks to poster Secret_Doom on computing.net
thank you!!
ReplyDeleteHelped. Thanks a lot.
ReplyDelete