for loop find by index in cmd code example
Example: for loop find by index in cmd
@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
)