- @echo off
- rem 假设每行均不超过100个字符
- set /a m=1001,n=0,max=每行最多字符数=100
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('type "大文本.txt"') do (
- set "str=%%a"
- set /a h=0
- for /l %%l in (0,1,%max%) do (
- if not "!str:~%%l,1!" equ "" (
- set /a n+=1,h+=1
- )
- )
- if !n! geq 200 (
- set /a m+=1,n=h
- )
- >>小文本!m:~-3!.txt echo %%a
- )
- endlocal
- pause
复制代码
将文本和批处理均以ansi编码格式保存 |