Friday 27 February 2015

Simple batch programming on Windows

Some simple tricks for batch programming on Windows environment:

1) For loop (refer: http://ss64.com/nt/for_l.html)
Syntax   
      FOR /L %%parameter IN (start,step,end) DO command

Key
   start       : The first number
   step        : The amount by which to increment the sequence
   end         : The last number

   command     : The command to carry out, including any
                 command-line parameters.

   %%parameter : A replaceable parameter:
                 in a batch file use %%G (on the command line %G)

Example
FOR /L %%G IN (0,1,195) DO (
echo %%G & ping 1.1.1.1 -n 1 -w 1000 >nul

)

2) ...

No comments:

Post a Comment