从bat脚本执行同步curl调用

时间:2016-02-10 19:30:04

标签: batch-file curl

我整理了一个基本的批处理脚本,该脚本从txt文件中获取单词,并在// ... pseudocode std::wofstream outfile; outfile.open("words.txt", std::ios_base::app); outfile << "something"; outfile.close(); // ... 为搜索参数的三个网址上执行curl。结果放在一个html页面中。但是,我遇到了一个问题..这是一个缓慢的过程。如何同时为search_word curl执行urls

@echo off
setlocal enabledelayedexpansion
set OUTPUT_FILE=test.html
for /f %%i in (search_words.txt) do (
    curl -k -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0" http://www.example.com/search?q=%%i >>%OUTPUT_FILE%
    curl -k -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0" http://www.example2.com/search?q=%%i >>%OUTPUT_FILE%
    curl -k -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0" http://www.example3.com/search?q=%%i >>%OUTPUT_FILE%
)

0 个答案:

没有答案