如何在我的 for 循环批处理脚本中获得更多的令牌,输出 %%a 等

how to get more tokens acknowledged in my for loop batch script, outputting %%a, etc

这是我正在尝试的代码 运行:

@echo off
setlocal enabledelayedexpansion

set "input_file=%CD%\file3.csv"
type nul > file4.csv

for /f "tokens=* delims=," %%z in ('type !input_file!') do (
    set line=%%z
    for /f "tokens=1,2,3,4,15,19,20,41,42,43,44,45,55 delims=," %%a in ("!line:,=^,!") do (
    set newline=%%a,%%b,%%c,%%d,%%e,%%f,%%g,%%h,%%i,%%j,%%k,%%l,%%m
    for /f "tokens=* delims=," %%x in ("!newline:^=!") do (
    set nline=%%x
    echo !nline! >> file4.csv
)
)
)

pause

直接输出

,%%h,%%i,%%j,%%k,%%l,%%m

在1-20中实际数据之后的换行符变量中。我如何让 for 循环考虑那些后来的标记?

for /f "tokens=1,2,3,4,15,19,20,* delims...%%a in (....
 for /f "tokens=19,* delims...%%i in ("%%h") do
  for /f "tokens=1,2,3,4,5,15 delims...%%k in ("%%j") do

  echo %%a,%%b,%%c,%%d,%%e,%%f,%%g,%%k,%%l,%%m,%%n,%%o,%%p

应该提取适当的标记。