📜  for循环在cmd中按索引查找 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:05.739000             🧑  作者: Mango

代码示例1
@echo OFF
setlocal EnableDelayedExpansion

if "%1" == "" (
    set pattern=*
) else (
    set pattern=%1
)

set i=0
for %%g in (%pattern%) do (
   set /A i+=1
   echo [!i!]  %%g
)