- @echo off
- pushd "%~sdp0"
- setlocal enabledelayedexpansion
- set/a a=0,e=0
- (for /f "delims=" %%a in (abc.html) do (
- set q=%%a
- set w=!q:^<title^>=!
- if !w! neq !q! (
- set a=1
- )
- if !a!==1 (
- set e=!q:^</title^>=!
- if !e! neq !q! (
- echo;^<title^>测试页面1^</title^>
- set a=0
- )
- ) else (
- echo;%%a
- )
- ))>new_abc.html
-
- (for /f "delims=" %%a in (def.html) do (
- set q=%%a
- set w=!q:^<title^>=!
- if !w! neq !q! (
- set a=1
- )
- if !a!==1 (
- set e=!q:^</title^>=!
- if !e! neq !q! (
- echo;^<title^>测试页面2^</title^>
- set a=0
- )
- ) else (
- echo;%%a
- )
- ))>new_def.html
-
- pause
- exit
复制代码
|