本帖最后由 went 于 2020-4-11 11:21 编辑
- @echo off
- setlocal enabledelayedexpansion
- REM txt folder
- set "folder=C:\Users\lenovo\Desktop\xxx"
- REM csv file
- set "csv=out.csv"
- for /r "%folder%" %%a in ("*.txt") do (
- set "max="
- for /f "usebackq tokens=1-3* delims=#" %%i in ("%%a") do (
- if "!max!"=="" (
- set "max=%%k"
- set "line=%%i#%%j#%%k#%%l"
- ) else (
- if %%k gtr !max! (
- set "max=%%k"
- set "line=%%i#%%j#%%k#%%l"
- )
- )
- )
- echo %%a
- echo !max!,!line!
- echo !max!,!line! >>"%~dp0%csv%"
- echo ----------------------
- )
- pause&exit
复制代码
|