how to continue the next iteration in for loop
Posted: 19 May 2014 03:53
Hi All,
I am looking for a continue equivalent in batch script.
Is there a way we can continue the next iteration of the for loop breaking the current iteration based on a condition.
-------
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%A in ('dir /b C:\') do (
set value=%%A
if "!value!" EQU "test" (
echo "The test directory"
)
echo !value!
)
---------------------
if the value is equal to test I want to break the current iteration and continue with the next iteration of the for loop.
Thanks
SS
I am looking for a continue equivalent in batch script.
Is there a way we can continue the next iteration of the for loop breaking the current iteration based on a condition.
-------
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%A in ('dir /b C:\') do (
set value=%%A
if "!value!" EQU "test" (
echo "The test directory"
)
echo !value!
)
---------------------
if the value is equal to test I want to break the current iteration and continue with the next iteration of the for loop.
Thanks
SS