本帖最后由 pcl_test 于 2015-3-3 01:06 编辑
回复 8# syqh2010
已更正,适配各种情况- @echo off
- setlocal enabledelayedexpansion
- >"汇总.csv" echo,文件名,X,Y,Z
- for %%a in (*.txt) do (
- findstr "x=" "%%a" >>$ ||echo x= >>$
- echo.>>$
- findstr "y=" "%%a" >>$ ||echo y= >>$
- echo.>>$
- findstr "z=" "%%a" >>$ ||echo z= >>$
- for /f "delims=" %%i in ($) do >>$$ echo,%%i,
- move $$ $ >nul
- set s=
- for /f "tokens=1* delims==" %%b in ('findstr "x= y= z=" "$"') do set "s=!s!%%c"
- >>"汇总.csv" echo,%%~na,!s!
- del $
- )
- pause
复制代码
|