DOS批处理遍历列表中的数字

dr_*_*_rk 3 windows for-loop cmd batch-file

我需要遍历DOS批处理文件中的数字列表。我已经试过了:

for /l %%n in (10,13,14,15) do ( 
     REM do something 
)
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用。正确的语法是什么?www上的批处理文件上没有什么适当的文档。

Sud*_*eej 5

尝试这个

    @echo off

    set nums=10,13,14,15

    for %%i in (%nums%) do (
      echo %%i
    )
Run Code Online (Sandbox Code Playgroud)