bat如何判断变量a %a%的字符数
参考下: @echo?off set?str='test' :next1 if?not?"%str%"==""?( set?/a?num =1 set?"str=%str:~1%" goto?next1 ) echo?%str% echo?str的长度为:%num% ? 程序有点小问题,修改好的@echo offset /a num=0set str=test:next1if not "%str%"=="" (set /a num =1set "str=%str:~1%"goto next1)echo str的长度为:%num% 。
参考下: @echo?off set?str='test' :next1 if?not?"%str%"==""?( set?/a?num =1 set?"str=%str:~1%" goto?next1 ) echo?%str% echo?str的长度为:%num% ? 程序有点小问题,修改好的@echo offset /a num=0set str=test:next1if not "%str%"=="" (set /a num =1set "str=%str:~1%"goto next1)echo str的长度为:%num% 。
收起