windows - Batch script for wget -
i need script download images resursive, how can it. on windows.
i want this:
for(int = 0 ; < 100; i++) { wget "http://download/img" + + ".png }
how can windows batch script?
the windows equivalent sort of for
loop for /l
. syntax is
for /l %%i in (start,step,finish) (stuff)
see help for
in console window more info. also, windows batch variables evaluated inline. no need break out of quotes.
for /l %%i in (0,1,100) ( wget "http://download/img%%i.png" )
... download img0.png through img100.png no numeric padding.
if numbers 0 padded, there's added element consider -- delayed expansion. within for
loop, variables evaluated before for
loop loops. delaying expansion causes variables wait until each iteration evaluated. so, 0 padding taking right-most 3 characters requires this:
setlocal enabledelayedexpansion /l %%i in (0,1,100) ( set "idx=00%%i" wget "http://download/img!idx:~-3!.png" )
... download img000.png through img100.png.
Comments
Post a Comment