按照个人书写习惯1楼代码一般这样- for /f "tokens=1-3 delims= " %%a in (' dir /b/s/a-d *.txt *.csv ') do (
- >>"%%a.tmp" echo %%a %%b %%c
- )
复制代码
- @echo off
- cd /d "%~dp0"
- for /r %%i in (*.txt) do (
- (for /f "useback tokens=1-3 delims= " %%a in ("%%i") do (
- echo=%%a %%b %%c
- ))>"%%i.tmp"
- )
- for /r %%i in (*.csv) do (
- (for /f "useback tokens=1-3 delims=," %%a in ("%%i") do (
- echo=%%a %%b %%c
- ))>"%%i.tmp"
- )
- pause
复制代码
分隔符不同可以分开写。 |