这样行不?- @echo off&chcp 936
- echo 进行中,请耐心等待
- set "outfile=___output.csv"
-
- cd.>"%outfile%"
- for %%b in ("*.xml") do (
- setlocal
- echo,file,%%~b>>%outfile%
- (for /f "skip=1 delims=" %%c in ('findstr /n .* "%%~b"') do (
- set line1=
- set /p line1=
- set line2=%%c
-
- if not defined item (
- setlocal enabledelayedexpansion
- if "!line1:<item>=!" neq "!line1!" (
- for %%- in (1) do endlocal&set item=%%-) else endlocal
- ) else (
-
- setlocal enabledelayedexpansion
- if "!line1:Soul Crystal=!" neq "!line1!" (
- set line3=!line2:* =!&set line3=!line3:~0,-2!
- 2>nul set /a !line3:id=,id!
- for %%- in ("!id!") do endlocal&set o=%%~-&set match=1
- if "!p!" == "!q!" endlocal
- ) else endlocal
-
- if defined match (
- setlocal enabledelayedexpansion
- if "!line2:</item>=!" neq "!line2!" (
- set line3=!line1:* =!&set line3=!line3:~0,-2!
- 2>nul set /a !line3:id=,id!
- echo,!o!,!id!
- endlocal&set o=&set match=&set item=
- ) else endlocal
- )
-
- )
- ))<"%%~b">>"%outfile%"
- endlocal
- )
- echo,&echo 完成&pause
复制代码
|