本帖最后由 WHY 于 2016-9-15 23:33 编辑
- @echo off
- (for %%i in (*.csv) do (
- setlocal enabledelayedexpansion
- for /f "tokens=* usebackq" %%j in ("%%i") do (
- set "s=%%j"
- if not defined n (
- for %%k in ("!s:,=","!") do set /a n+=1 & set "_!n!=%%~k"
- ) else (
- set m=0
- for %%k in ("!s:,=","!") do (
- set /a m+=1
- if !m! GTR 1 (
- for %%L in (!m!) do (
- if "!_%%L!" NEQ "" if %%~k GTR 0 set "s=!s!,!_%%L!"
- )
- ) else set "s=%%~k,,"
- )
- if "!s:~-1!" NEQ "," echo;!s!
- )
- )
- endlocal
- ))>D:\ALL.csv
- pause
复制代码
|