对文本文档中的每个条目自动运行curl

发布于 2024-12-18 13:46:00 字数 698 浏览 2 评论 0原文

我试图消除手动输入每个单独的选择,并让卷曲从文本文档中读取,并为文档中列出的每个选择自动运行卷曲。这是我目前拥有的基本卷曲,可以运行一个手动输入的选择。

echo AccountNumber to set 
set /p AccNum =

curl -X PATCH http://localhost:3232/docs/AccountNumbers/%AccNum% -d 
"@StateCountyCurl.txt" -w "\n\n"

pause

这将提示用户输入每个单独的 AccNum 并将根据 StateCountyCurl.txt 文件中的数据运行curl。我有另一个名为 AccountNumbers.txt 的文件,其中包含所有帐号。我想修改这个curl语句,以便它一一读取所有帐号并运行curl,而不必每次都手动输入每个号码。感谢您的帮助和建议。

我正在寻找类似(不确定语法)

echo AccountNumber to set 
set /p AccNum = "AccountNumbers.txt" //run for every number in this text doc.

curl -X PATCH http://localhost:3232/docs/AccountNumbers/%AccNum% -d 
"@StateCountyCurl.txt" -w "\n\n"

暂停的东西

I am trying to eliminate entering each individual choice manually and have the curl read from a text document and run the curl automatically for every choice listed in the document. This is the basic curl I have at the moment that can run for one single manually entered choice.

echo AccountNumber to set 
set /p AccNum =

curl -X PATCH http://localhost:3232/docs/AccountNumbers/%AccNum% -d 
"@StateCountyCurl.txt" -w "\n\n"

pause

This will prompt the user to enter each individual AccNum and will run the curl based on the data in the StateCountyCurl.txt file. I have another file called AccountNumbers.txt which has all the account numbers in it. I would like to modify this curl statement so that it reads all account numbers one by one and runs the curl without me having to enter each number manually every time. Thank you for your help and suggestions.

I am looking for something like (not sure of the syntax)

echo AccountNumber to set 
set /p AccNum = "AccountNumbers.txt" //run for every number in this text doc.

curl -X PATCH http://localhost:3232/docs/AccountNumbers/%AccNum% -d 
"@StateCountyCurl.txt" -w "\n\n"

pause

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2024-12-25 13:46:00

您想要使用 FOR 和 FINDSTR:

FOR /F "tokens=1,2* delims=!" %%a IN ('findstr /b /v ^; "AccountNumbers.txt"') DO (
    curl -X PATCH http://localhost:3232/docs/AccountNumbers/%%a -d "@StateCountyCurl.txt" -w "\n\n"
)

有关 FINDSTR 的更多信息: http://technet.microsoft.com/en-us/library/bb490907.aspx

有关 FOR 的更多信息:http://technet.microsoft.com/en-us/library/bb490909.aspx

You want to use FOR and FINDSTR:

FOR /F "tokens=1,2* delims=!" %%a IN ('findstr /b /v ^; "AccountNumbers.txt"') DO (
    curl -X PATCH http://localhost:3232/docs/AccountNumbers/%%a -d "@StateCountyCurl.txt" -w "\n\n"
)

More on FINDSTR: http://technet.microsoft.com/en-us/library/bb490907.aspx

More on FOR: http://technet.microsoft.com/en-us/library/bb490909.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文