请参阅我的问题Looping using FOR in batch (*.bat) / CMD。
我想使用 wget 来获取一个 excel 文件。
excel01.xls --> link : http://portal/excel01.xls
excel02.xls --> link : http://portal/excel02.xls
...
excel12.xls --> link : http://portal/excel12.xls
我的代码:
echo off
set /P start= Input start : %=%
set /P end= Input End : %=%
for /l %%i IN (%start%,1,%end%) DO echo wget "http://portal/excel0%%i.xls"
pause
结果 :
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 any key to continue . . .
导致第 10-12 行的正确脚本如何:
wget "http://portal/excel010.xls"
wget "http://portal/excel011.xls"
wget "http://portal/excel012.xls"
变得
wget "http://portal/excel10.xls"
wget "http://portal/excel11.xls"
wget "http://portal/excel12.xls"
对不起,我的英语说得不太好。:)