首页 > 解决方案 > 让 Windows Batch 命令等待 CURL 结果再继续

问题描述

    for /R %%f in ("*") do (
       for /F %%I in ('C:\curl\bin\curl -v -L ipinfo.io') do set myip=%%I &
       start.exe -ip %myip%
   )

是否可以让 windows bat 等待 curl 结果,在这种情况下(myip),然后将其作为 args 传递给 start.exe?谢谢。

标签: windowsbatch-file

解决方案


Setlocal EnableDelayedExpansion

感谢 Compo,我现在能够在下一个命令之前加载 ip。


推荐阅读