Using wget to get an excel files with FOR loop syntax on batch/CMD (*.bat) programing -
refer question looping using in batch (*.bat) / cmd.
i want use wget excel files.
excel01.xls --> link : http://portal/excel01.xls excel02.xls --> link : http://portal/excel02.xls ... excel12.xls --> link : http://portal/excel12.xls
my code :
echo off set /p start= input start : %=% set /p end= input end : %=% /l %%i in (%start%,1,%end%) echo wget "http://portal/excel0%%i.xls" pause
result :
input start : 1 input end : 12 wget "http://portal/excel01.xls" wget "http://portal/excel02.xls" wget "http://portal/excel03.xls" wget "http://portal/excel04.xls" wget "http://portal/excel05.xls" wget "http://portal/excel06.xls" wget "http://portal/excel07.xls" wget "http://portal/excel08.xls" wget "http://portal/excel09.xls" wget "http://portal/excel010.xls" wget "http://portal/excel011.xls" wget "http://portal/excel012.xls" press key continue . . .
how correct script results in row 10-12 :
wget "http://portal/excel010.xls" wget "http://portal/excel011.xls" wget "http://portal/excel012.xls"
become
wget "http://portal/excel10.xls" wget "http://portal/excel11.xls" wget "http://portal/excel12.xls"
i'm sorry not speak english well. :)
this script prepends 0
number, gets last 2 characters. have assumed don't need worry numbers >= 100.
@echo off setlocal enableextensions setlocal enabledelayedexpansion set /p start= input start : %=% set /p end= input end : %=% /l %%i in (%start%,1,%end%) ( set num=0%%i set num=!num:~-2! echo wget "http://portal/excel!num!.xls" ) pause
Comments
Post a Comment