MS-DOS Counted Loops – ITERATION

Using the /L switch for the FOR command, it is possible to count through a loop in MS-DOS; just like any other scripting languages.

Consider this as a very simple sample. It counts from 0 to 99; including both 0 and 99; with a step size of 1 and executes the loop’s body for each iteration.

FOR /L %i IN (0,1,99) DO (
  echo Attempt# %i
  nslookup google.com 4.2.2.4
)

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">