【发布时间】:2013-08-28 02:47:18
【问题描述】:
这个脚本有什么问题?
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set /P start= Input start : %=%
set /P end= Input End : %=%
for /l %%i IN (%start%,1,%end%) DO (
set num=0%%i
set num=!num:~-2!
echo wget "http://portal/excel!num!.xls"
)
pause
如果Input start = 01、Input End = 06,工作正常并下载excel文件。结果:
Input start : 01
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/excel10.xls"
Press any key to continue . . .
但是如果Input start = 01, Input End = 08 或者
如果Input start = 01,Input End = 09,不能正常工作并且没有下载excel文件。结果:
Input start : 01
Input End : 08
Press any key to continue . . .
谁能解释一下?
【问题讨论】:
标签: loops batch-file for-loop cmd