写到临时文件的话,这样就可以了,dir + find 效率太低了 | @echo off | | echo i like the bathome,because here is the batch of the world.>x.x | | for %%a in (x.x) do set/a n=%%~za-2 | | echo %n% | | | | pauseCOPY |
80字符以内可以这样,是否更好一点呢? | | | @echo off&setlocal enabledelayedexpansion | | set "str=i like the bathome,because here is the batch of the world." | | for /l %%i in (0 1 80) do (if "!str:~%%i,1!" equ "" set n=%%i&goto end) | | set n=0 | | :end | | echo %n%&pauseCOPY |
[ 本帖最后由 netbenton 于 2009-5-11 23:31 编辑 ] |