本帖最后由 batman 于 2011-4-1 16:42 编辑
- @echo off&setlocal enabledelayedexpansion
- for /r e:\测试 %%a in (*.csv) do (
- (for /f "usebackq delims=" %%b in ("%%a") do (
- set "var="&call :lp "%%b"
- for /f "tokens=1* delims=," %%b in ("!var!") do echo %%b,%%b,%%c
- ))>"%%~dpatem"
- del /q "%%a"&ren "%%~dpatem" "%%~nxa"
- )
- goto :eof
- :lp
- if not defined str set "str=%~1"
- for /f "tokens=1* delims=*" %%a in ("%str%") do (
- set "var=!var!;%%a"
- if "%%b" neq "" set "str=%%b"&goto lp
- )
- set "var=!var:~1!"&set "str="
复制代码
|