判断你写了多少个字符
- @echo off
- set mystr=
- set /p mystr=输入要计算长度的字符串(直接回车退出):
- if not defined mystr goto :eof
- set count=0
- setlocal enabledelayedexpansion
- :intercept
- set /a count+=1
- for /f %%i in ("%count%") do if not "!mystr:~%%i,1!"=="" goto intercept
- echo 长 度: %count%
- pause
- goto :eof
本文转自sucre03 51CTO博客,原文链接:http://blog.51cto.com/sucre/411652,如需转载请自行联系原作者