- @Echo Off&SetLocal EnableDelayedExpansion
- Set "OldPath=C:\1"&Rem 要读取的目录
- Set "NewPath=C:\2"&Rem 要保存的目录
- Set "Number=6 7"&Rem 要删除的列集合
- For %%i In (%OldPath%\*.csv) Do (
- (For /F "usebackq delims=" %%j In ("%%i") Do (
- Set /A Count=0&Set "Str="
- Set "Var=%%j"&Set "Var=!Var: =@@@@@@!"
- For %%k In (!Var!) Do (
- Set /A Count+=1&Set "Flag=A"
- For %%l In (%Number%) Do If %%l EQU !Count! Set "Flag="
- If Defined Flag Set "Str=!Str!,%%k"
- )
- Set "Str=!Str:@@@@@@= !"&Echo !Str:~1!
- ))>"%NewPath%\%%~nxi"
- )
复制代码
|