本帖最后由 CrLf 于 2011-11-19 19:04 编辑
原先代码有误,已修改:- @echo off&setlocal enabledelayedexpansion
- set key=05.07.06.
- (for /f "delims=" %%a in (1.txt) do (
- set var=
- set "str=%%a%key%"
- for /l %%b in (1 1 100) do (
- if defined str set str=!str:*%key%=!
- for /f "delims=." %%c in ("!str!") do set var=!var!%%c.
- )
- echo;!var!
- ))>2.txt
- pause
复制代码
- @echo off&setlocal enabledelayedexpansion
- set key=05.07.06.
- (for /f "delims=" %%a in (1.txt) do (
- set var=
- set str=%%a
- for %%b in (@!str:%key%^=^ !) do (
- for /f "eol=@ delims=." %%c in ("%%b") do set var=!var!%%c.
- )
- echo;!var!
- ))>2.txt
- pause
复制代码
|