- @echo off
- set "file=C:\Program Files\aa bb\a.txt"
- set "file2=C:\Program Files\aa bb\20160818_Export_c.txt"
- set "tmpFile=C:\Program Files\aa bb\c.txt"
- set "dirFile=C:\Program Files\aa bb\test.txt"
- if exist "%tmpFile%" del /q "%tmpFile%"
- if exist "%dirFile%" del /q "%dirFile%"
-
- for /f "tokens=1,2 delims=," %%a in ("%file%") do (
- for /f "tokens=*" %%i in ('type "%file2%" ^| findstr %%a') do (
- >>"%tmpFile%" echo %%i
- )
- rem call :G_getrows "C:\Users\fan-17\Desktop\a.txt" kk
- )
-
- setlocal enabledelayedexpansion
- (for /f "tokens=1-8 delims=," %%a in ('type "%tmpFile%"') do (
- set /p StrLine=
- for /f "tokens=2 delims=," %%x in ("!StrLine!") do (
- set StrCol=%%x
- )
- echo ,%%a,%%b,!StrCol!,%%d,%%e,%%f,%%g,%%h
- ))<"%file%" > "%dirFile%"
-
- if exist "%tmpFile%" del /q "%tmpFile%"
复制代码 如果这个代码还是报错,你可以把 @echo off 删掉,在CMD窗口执行 test.bat 这样可以看到具体是哪里在报错。 |