if "!bb!" neq "" (
set /a n+=1
set bb=!bb:~1!
)
你以为这句是循环?不是的。
----------------------------------------- @echo off
- set /a LineNum = 0, MaxLen = 0, n = 0
- for /f "delims=" %%a in (1.txt) do (
- set /a LineNum += 1
- set s=%%a#
- setlocal enabledelayedexpansion
- for %%a in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
- if "!s:~%%a,1!" neq "" (
- set /a n += %%a
- set s=!s:~%%a!
- )
- )
- if !n! gtr !MaxLen! (
- for %%n in (!n!) do (
- endlocal
- set MaxLen=%%n
- set str=%%a
- )
- ) else endlocal
- )
-
- set LineNum
- set MaxLen
- set str
- pause
复制代码
|