回复 1# wh1234567
- set "one=----"
- set "two=="
- for %%i in (one,two)do (
- for /l %%n in (0,1,8192)do if /i not "!%%~i:~%%n,1!"=="" set/a "%%~i_n=%%~n+1"
- echo,!%%~i_n!
- )
- for /f "delims=" %%i in ('type "%~dp0批处理如何删除文本中每一行两个指定字符串之间的内容.txt"')do (
- set "Character=%%i"
- set "n="
- set "new_one="
- set "new_two="
- for /l %%n in (0,1,8192)do if /i not "!Character:~%%~n,1!"=="" if /i "!Character:~%%~n,%one_n%!"=="!one!" (
- set/a "n+=1"
- if !n!==2 (
- set "new_one=!Character:~0,%%~n!"
- )
- )else if /i "!Character:~%%~n,%two_n%!"=="!two!" (
- set "new_two=!Character:~%%~n!"
- )
- echo,!new_one!!new_two!
- )
复制代码
|