本帖最后由 apang 于 2015-3-3 23:48 编辑
这样试试:- @echo off
- set "re=\[FineCuttingHsc101\]"
- set "fPath=D:\Test\"
- set "str=CuttingSpeed,LensSpeed,LensSpeedMaster,LensSpeedSphere,CuttingDepth,SpiralDistance,DotDistance"
-
- pushd "%fPath%"
- echo,Name,Side,%str%>"%~dp01.csv"
- (for /f "tokens=1,2delims=:" %%i in ('findstr /in "%re%" *.R *.L') do (
- setlocal enabledelayedexpansion
- set "s=%%~xi"
- for /f "tokens=*" %%a in ('more +%%j "%%i"') do (
- set "s1=%%a"
- if "!s1:~,1!" == "[" set flag=1
- if not defined flag set "%%a"
- )
- for %%a in (%str%) do set "s=!s!,!%%a!"
- echo,%%~ni,!s:~1!
- endlocal
- ))>>"%~dp01.csv"
- pause
复制代码
|