文本中不能含有 * 号- @echo off
- set "文本=1.txt"
- set "分隔符=。"
-
- findstr /n .* "%文本%" >.tmp
- set n=1
- for /f "delims=" %%a in (.tmp) do (
- set var=%%a
- SetLocal EnableDelayedExpansion
- set var=!var:*:=!
- if "!var!" neq "" (
- if "!var:%分隔符%=!" neq "!var!" (
- set var=!var:?=?!
- set var=!var:"=”!
- for %%b in ("!var:%分隔符%=" "!") do (
- >.tmp echo !n!
- EndLocal
- set var=%%~b
- set /a n += 1
- set /p m=<.tmp
- SetLocal EnableDelayedExpansion
- set var=!var:?=?!
- >>"!文本:~0,-4!_!m!.txt" echo,!var:”="!
- )
- ) else >>"!文本:~0,-4!_!n!.txt" echo,!var!
- ) else >>"!文本:~0,-4!_!n!.txt" echo,!var!
- EndLocal
- )
-
- del .tmp
复制代码
[ 本帖最后由 tmplinshi 于 2011-1-16 23:00 编辑 ] |