【问题标题】:command batch file curl upload命令批处理文件 curl 上传
【发布时间】:2014-10-28 20:26:02
【问题描述】:

我必须使用 curl 上传文件。 我可以使用文件名上传单个或多个文件,但我想用 *.csv 掩码上传文件中的所有文件。我怎么能上传它。正如我在一篇帖子中看到的,curl 不支持通配符。

ForFiles /m *.csv /c "cmd /c curl.exe -u "username:passowrd" -ssl --cacert "cacert.pem" -F "pfile=@stasticsData.csv" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt

如果我可以使用以下相同的 ForFiles,我可以在 @file 中获取文件名

ForFiles /m *.csv /c "cmd /c echo @file

我试过合并,它不起作用,请帮助

ForFiles /m *.csv /c "cmd /c curl.exe -u "username:passowrd" -ssl --cacert "cacert.pem" -F "pfile=@file" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt

【问题讨论】:

    标签: windows batch-file curl cmd command


    【解决方案1】:

    我得到了答案:

    for %%f in (*.csv) do (
      curl.exe -u "username:password" -ssl --cacert "cacert.pem" -F "pfile=@%%f" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-23
      • 1970-01-01
      • 1970-01-01
      • 2019-11-15
      • 1970-01-01
      • 2013-03-26
      • 2013-07-05
      • 1970-01-01
      相关资源
      最近更新 更多