读入一个urls.txt的文件,读取每一行,得到\的总数,得到\的前后位置,取\中间文本,但是代码在去出中间部分的时候不执行,查了资料也么有搞明白,那我指导一下。- @echo off &setlocal
- for /f "delims=" %%a in (urls.txt) do (
- echo,%%a>0.0&for %%v in (0.0) do set "v1=%%~zv"
- setlocal enabledelayedexpansion &set "s=%%a" &set "s=!s:\=!"
- echo,!s!>0.0&for %%v in (0.0) do set "v2=%%~zv"
- set/a "v=v1-v2"
- set/a "we=v-1"
- set/a "we2=v-2"
- set "line=%%a"
- for /f "tokens=%we%,%we2% delims=\" %%i in ("%line%") do (
- set "middlePart=%%i")
- endlocal
- )
- del/q "0.0"&endlocal&pause&exit/b
-
- pause
复制代码
|