本帖最后由 aloha20200628 于 2024-8-10 19:29 编辑
回复 1# meixi
假设已被下载的指定网页文件为 1.xml,用如下的批处代码可获取网页文件中包含关键词 ‘Download package’ 的a标签链址- @echo off &(for /f tokens^=2^delims^=^" %%a in ('findstr /ic:">Download package<" 1.xml') do echo,%%a
- pause&exit/b
复制代码 不用下载 wget 等第三方专业下载工具即可直接下载网页的方法,已经试过 certutil.exe 和 powershell,其中 invoke-webrequest 最慢,(new-object System.Net.WebClient).DownloadFile 稍快...- @echo off &certutil -urlcache -split -f "https://www.nuget.org/packages/python" "1.xml">nul 2>nul
- for /f tokens^=2^delims^=^" %%a in ('findstr /ic:">Download package<" 1.xml') do echo,%%a
- pause&exit/b
复制代码
- @echo off &powershell -c "(new-object System.Net.WebClient).DownloadFile('https://www.nuget.org/packages/python', '1.xml')"
- for /f tokens^=2^delims^=^" %%a in ('findstr /ic:">Download package<" 1.xml') do echo,%%a
- pause&exit/b
复制代码 </size> |