dos batch iterate through a delimited string
Posted
by bjax-bjax
on Stack Overflow
See other posts from Stack Overflow
or by bjax-bjax
Published on 2010-03-26T16:32:16Z
Indexed on
2010/03/26
16:33 UTC
Read the original article
Hit count: 452
I have a delimited list of IPs I'd like to process individually. The list length is unknown ahead of time. How do I split and process each item in the list?
@echo off
FOR /f "tokens=* delims=," %%a IN ("127.0.0.1,192.168.0.1,10.100.0.1") DO call :sub %%a
:sub
echo In subroutine
echo %1
exit /b
Outputs:
In subroutine
127.0.0.1
In subroutine
ECHO is off.
© Stack Overflow or respective owner