简体   繁体   中英

loop in cmd for batch downloading

I've problem with loop in cmd for batch downloading. I want to exectute my python script to downloaded (it working), but in loop in cmd.

without loop, there is

python script.py -a mandatory_argument https_adress

My loop is like below:

for %x in (https_address_1, https_adress_2) do (
   echo %x 
   python script.py -a mandatory_argument %x
)

Is there any kind of obvious mistake?

I do not know your script.py program. But, the FOR loop variables inside a .bat or .cmd file script must have double percent characters. Using QUOTATION MARK and TILDE are defensive tactics.

for %%x in (https_address_1, https_adress_2) do (
   echo "%%~x"
   python script.py -a mandatory_argument "%%~x"
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM