本帖最后由 happyxxdhaha 于 2015-2-22 18:50 编辑
- @echo off
- for /f "delims=" %%i in (c:\temp\1.html) do (
- set str=%%i
- setlocal enabledelayedexpansion
- call :sub
- endlocal
- )
- exit /b
-
- :sub
- set/a n+=1
- set str1=!str:~,%n%!
- if "!str1:~-8!"=="content=" set/a p1=!n!+1
- if "!str1:~-8!"=="download" set/a p2=!n!-!p1!-8
- if not defined p1 goto ret
- if not defined p2 goto ret
- >>c:\1.txt echo,!str:~%p1%,%p2%!
- exit /b
-
- :ret
- if "!str1!" equ "!str!" exit /b
- goto sub
复制代码
|