curl ^"https://t6.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS^&REQUEST=GetTile^&TILECOL=7^&TILEROW=0^&TILEMATRIX=3^&VERSION=1.0.0^&LAYER=img^&STYLE=default^&TILEMATRIXSET=c^&FORMAT=tiles^&tk=75f0434f240669f4a2df6359275146d2^" ^ -o ^"7.jpg^" ^ -H ^"Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8^" ^ -H ^"Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6^" ^ -H ^"Connection: keep-alive^" ^ -b ^"HWWAFSESID=181691274cd10b10d97; HWWAFSESTIME=1741612540343^" ^ -H ^"DNT: 1^" ^ -H ^"Referer: https://map.tianditu.gov.cn/2020/^" ^ -H ^"Sec-Fetch-Dest: image^" ^ -H ^"Sec-Fetch-Mode: no-cors^" ^ -H ^"Sec-Fetch-Site: same-site^" ^ -H ^"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0^" ^ -H ^"sec-ch-ua: ^\^"Chromium^\^";v=^\^"134^\^", ^\^"Not:A-Brand^\^";v=^\^"24^\^", ^\^"Microsoft Edge^\^";v=^\^"134^\^"^" ^ -H ^"sec-ch-ua-mobile: ?0^" ^ -H ^"sec-ch-ua-platform: ^\^"Windows^\^"^" 上面我命令,我需要将TILECOL从0循环到7,这样的cmd命令怎么写?
时间: 2025-05-13 20:00:32 AIGC 浏览: 34
为了实现 `TILECOL` 从 0 循环到 7 的功能,您可以使用批处理脚本(`.bat` 文件),该脚本会自动生成并执行相应的 `curl` 命令。以下是编写此脚本的一种方法:
```batch
@echo off
set "base_url=https://t6.tianditu.gov.cn/img_c/wmts?SERVICE=WMTS&REQUEST=GetTile&TILEROW=0&TILEMATRIX=3&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&tk=75f0434f240669f4a2df6359275146d2"
for /l %%x in (0,1,7) do (
setlocal enabledelayedexpansion
set tilecol=%%x
set filename=!tilecol!.jpg
echo Downloading !filename!...
curl "%base_url%&TILECOL=!tilecol!" ^
-o "!filename!" ^
-H "Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8" ^
-H "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6" ^
-H "Connection: keep-alive" ^
-b "HWWAFSESID=181691274cd10b10d97; HWWAFSESTIME=1741612540343" ^
-H "DNT: 1" ^
-H "Referer: https://map.tianditu.gov.cn/2020/" ^
-H "Sec-Fetch-Dest: image" ^
-H "Sec-Fetch-Mode: no-cors" ^
-H "Sec-Fetch-Site: same-site" ^
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0" ^
-H "sec-ch-ua: \"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Microsoft Edge\";v=\"134\"" ^
-H "sec-ch-ua-mobile: ?0" ^
-H "sec-ch-ua-platform: \"Windows\""
)
pause
```
保存上述内容为 `.bat` 文件,并运行它即可完成任务。
请注意,在实际操作前最好先测试单次下载是否正常工作,同时检查目标网站是否有访问限制或频率限制等规则以免违反其服务条款。
阅读全文